-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added deployment option for hackathon participants #2
Closed
Closed
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7510133
First commit
kongzii 41d79bc
Update lock
kongzii 9ccacfc
add benchmakr
kongzii 6ec2cc5
add to readme
kongzii b28670a
Review
kongzii 80472fa
Added deployment instructions
gabrielfior 4dd2054
Unified function calls for local- and remote runner.
gabrielfior b5de0bf
Small fixes
gabrielfior fdfd26f
Merge remote-tracking branch 'origin/main' into gabriel/deployment
gabrielfior 9504477
Small typo before PR review
gabrielfior 60f8945
Merge remote-tracking branch 'origin/main' into gabriel/deployment
gabrielfior 222de98
Deployment working
gabrielfior File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Deployment of agents | ||
|
||
This folder contains scripts for quickly deploying your agent to a cloud provider (Modal) and have it executed on a cron schedule. Additionally, a local setup is also provided. | ||
|
||
## Pre-requisites | ||
|
||
We suggest using Modal (modal.com) for deploying the agents for its simplicity. We don't use Modal in production. | ||
|
||
For deploying on Modal, follow the steps below: | ||
- Create account (https://modal.com/) | ||
- Install modal, setup auth key | ||
- Run | ||
```bash | ||
pip install modal | ||
python3 -m modal setup | ||
``` | ||
|
||
## Run locally | ||
|
||
```shell | ||
modal run deployment/local_runner.py | ||
``` | ||
|
||
## Run on the cloud | ||
|
||
- Run | ||
```shell | ||
modal deploy --name execute_agent deployment/remote_runner.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from eth_typing import HexAddress, HexStr | ||
from prediction_market_agent_tooling.markets.omen.omen_subgraph_handler import OmenSubgraphHandler | ||
|
||
|
||
def run(): | ||
# This class entails the agent logic for placing bets. | ||
# It could call for example the main() function from the trader folder. | ||
market_id = HexAddress(HexStr("0x57c6bab1ba758d911f11e67ef323acebcfca04b7")) | ||
print("Started function execution") | ||
market = OmenSubgraphHandler().get_omen_market_by_market_id(market_id) | ||
print(f"market {market}") | ||
print("Finished function execution") | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import modal | ||
|
||
from deployment.agent import run | ||
|
||
app = modal.App("example-get-started") | ||
|
||
|
||
@app.function() | ||
def execute(): | ||
run() | ||
|
||
|
||
@app.local_entrypoint() | ||
def main(): | ||
execute.local() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from modal import Image, App, Period | ||
|
||
from deployment.agent import run | ||
|
||
image = Image.from_registry("ghcr.io/gnosis/prediction-market-agent:main").pip_install("pydantic==2.6.1") | ||
gabrielfior marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
app = App(image=image) | ||
|
||
@app.function(schedule=Period(minutes=5)) | ||
def execute_remote(): | ||
run() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is everything pushed to this PR? This doesn't initialize any agent nor places bets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I reference the
main
function from thetrader
folder.