Skip to content

Commit

Permalink
[feat] Add more resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Dec 6, 2023
1 parent ccaa078 commit 9210b2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion collect_coordinator/job_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class JobDefinition:
requires: Optional[ComputeResources] = None
limits: Optional[ComputeResources] = None
env: Optional[Dict[str, str]] = None
deadline: timedelta = timedelta(minutes=30) # how long is the job allowed to run
deadline: timedelta = timedelta(hours=1) # how long is the job allowed to run
retries: int = 3 # in case the process failed, how many retries are allowed

@staticmethod
Expand Down
17 changes: 5 additions & 12 deletions collect_coordinator/worker_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

from arq.connections import ArqRedis
from arq.worker import Worker, Function
from bitmath import MiB, GiB
from bitmath import GiB
from fixcloudutils.asyncio import stop_running_task
from fixcloudutils.asyncio.timed import timed
from fixcloudutils.service import Service
from fixcloudutils.types import Json
from fixcloudutils.asyncio.timed import timed

from collect_coordinator.job_coordinator import JobDefinition, ComputeResources, JobCoordinator

Expand Down Expand Up @@ -137,16 +137,9 @@ def parse_collect_definition_json(self, js: Json) -> JobDefinition:
account = js["account"]
env = js.get("env") or {} # Optional[Dict[str, str]]
debug = js.get("debug", False) # Optional[bool]
account_len_hint = js.get("account_len_hint", 1) # Optional[int]
if account_len_hint == 1:
requires = ComputeResources(cores=1, memory=MiB(512))
limits = ComputeResources(cores=1, memory=GiB(2))
elif account_len_hint < 10:
requires = ComputeResources(cores=2, memory=GiB(3))
limits = ComputeResources(cores=4, memory=GiB(10))
else:
requires = ComputeResources(cores=4, memory=GiB(5))
limits = None
# each job run is one account
requires = ComputeResources(cores=1, memory=GiB(4))
limits = ComputeResources(cores=4, memory=GiB(16))

coordinator_args = [
"--write",
Expand Down

0 comments on commit 9210b2f

Please sign in to comment.