Skip to content

Commit 909745a

Browse files
Merge pull request #737 from bugout-dev/state-crawler-jobs-from-cli
State crawler jobs from cli
2 parents 1935d7f + c7cfe7a commit 909745a

File tree

11 files changed

+337
-82
lines changed

11 files changed

+337
-82
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Execute state clean labels crawler
3+
After=network.target
4+
5+
[Service]
6+
Type=oneshot
7+
User=ubuntu
8+
Group=www-data
9+
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
10+
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
11+
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" clean-state-labels --blockchain mumbai -N 10000
12+
CPUWeight=60
13+
SyslogIdentifier=mumbai-state-clean
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Execute Mumbai state clean labels crawler each 25m
3+
4+
[Timer]
5+
OnBootSec=50s
6+
OnUnitActiveSec=25m
7+
8+
[Install]
9+
WantedBy=timers.target
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Execute state crawler
3+
After=network.target
4+
5+
[Service]
6+
Type=oneshot
7+
User=ubuntu
8+
Group=www-data
9+
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
10+
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
11+
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --blockchain mumbai --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/mumbai-jobs.json
12+
CPUWeight=60
13+
SyslogIdentifier=mumbai-state

crawlers/deploy/mumbai-state.timer

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Execute Mumbai state crawler each 10m
3+
4+
[Timer]
5+
OnBootSec=15s
6+
OnUnitActiveSec=10m
7+
8+
[Install]
9+
WantedBy=timers.target

crawlers/deploy/polygon-state.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ User=ubuntu
88
Group=www-data
99
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
1010
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
11-
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --blockchain polygon
11+
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" crawl-jobs --blockchain polygon --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/polygon-jobs.json
1212
CPUWeight=60
1313
SyslogIdentifier=polygon-state

crawlers/mooncrawl/mooncrawl/settings.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,24 @@
210210
MOONSTREAM_S3_PUBLIC_DATA_BUCKET_PREFIX = os.environ.get(
211211
"MOONSTREAM_S3_PUBLIC_DATA_BUCKET_PREFIX", "dev"
212212
)
213+
214+
215+
# infura config
216+
217+
218+
INFURA_PROJECT_ID = os.environ.get("INFURA_PROJECT_ID")
219+
220+
infura_networks = {
221+
AvailableBlockchainType.ETHEREUM: {
222+
"name": "mainnet",
223+
"url": f"https://mainnet.infura.io/v3/{INFURA_PROJECT_ID}",
224+
},
225+
AvailableBlockchainType.POLYGON: {
226+
"name": "polygon",
227+
"url": f"https://polygon-mainnet.infura.io/v3/{INFURA_PROJECT_ID}",
228+
},
229+
AvailableBlockchainType.MUMBAI: {
230+
"name": "mumbai",
231+
"url": f"https://polygon-mumbai.infura.io/v3/{INFURA_PROJECT_ID}",
232+
},
233+
}

0 commit comments

Comments
 (0)