Skip to content
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

Assign different jobNumber to each Athena process #56

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/raythena/actors/esworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ESWorker(object):
}

def __init__(self, actor_id: str, config: Config,
session_log_dir: str, job: PandaJob = None, event_ranges: Sequence[EventRange] = None) -> None:
session_log_dir: str, actor_no: int, actor_count: int, job: PandaJob = None, event_ranges: Sequence[EventRange] = None) -> None:
"""
Initialize attributes, instantiate a payload and setup the workdir

Expand All @@ -95,6 +95,8 @@ def __init__(self, actor_id: str, config: Config,
event_ranges: optional pre-assigned event ranges to process
"""
self.id = actor_id
self.actor_no = actor_no
self.actor_count = actor_count
self.config = config
self._logger = make_logger(self.config, self.id)
self.session_log_dir = session_log_dir
Expand Down Expand Up @@ -191,6 +193,12 @@ def modify_job(self, job: PandaJob) -> PandaJob:
if "--multiprocess" not in cmd:
cmd = f"--multiprocess=True {cmd}"

job_number = int(job["attemptNr"]) * self.actor_count + self.actor_no
if "--jobNumber=" in cmd:
cmd = re.sub(r"--jobNumber=[0-9]+", f"--jobNumber={job_number}", cmd)
else:
cmd = f"{cmd} --jobNumber={job_number} "

job["jobPars"] = cmd
return job

Expand Down
4 changes: 3 additions & 1 deletion src/raythena/drivers/esdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ def create_actors(self) -> None:
kwargs = {
'actor_id': actor_id,
'config': self.config_remote,
'session_log_dir': self.session_log_dir
'session_log_dir': self.session_log_dir,
'actor_no': i,
'actor_count': self.n_actors,
}
job = self.bookKeeper.assign_job_to_actor(actor_id)
if job:
Expand Down
Loading