From 64bcbe2e83e572f583e4c1ed90be18a056ee86a5 Mon Sep 17 00:00:00 2001 From: yuema137 <3124558229@qq.com> Date: Fri, 19 Apr 2024 18:30:28 -0500 Subject: [PATCH 1/4] add partition info in test --- tests/test_batchq.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_batchq.py b/tests/test_batchq.py index b99e1f3..bb75a90 100644 --- a/tests/test_batchq.py +++ b/tests/test_batchq.py @@ -11,6 +11,7 @@ def valid_job_submission() -> JobSubmission: return JobSubmission( jobstring="Hello World", + partition="xenon1t", qos="xenon1t", hours=10, container="xenonnt-development.simg", @@ -151,3 +152,5 @@ def test_submit_job_arguments(): assert ( len(missing_params) == 0 ), f"Missing parameters in submit_job: {', '.join(missing_params)}" + + \ No newline at end of file From 82a36ce65ceacd7c4c831f154dae83a257fcbbb5 Mon Sep 17 00:00:00 2001 From: yuema137 <3124558229@qq.com> Date: Fri, 19 Apr 2024 18:31:16 -0500 Subject: [PATCH 2/4] put bind in front of partition --- utilix/batchq.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilix/batchq.py b/utilix/batchq.py index e72afd0..dd43ae2 100644 --- a/utilix/batchq.py +++ b/utilix/batchq.py @@ -123,6 +123,10 @@ class JobSubmission(BaseModel): False, description="Exclude the loosely coupled nodes" ) log: str = Field("job.log", description="Where to store the log file of the job") + bind: List[str] = Field( + default_factory=lambda: DEFAULT_BIND, + description="Paths to add to the container. Immutable when specifying dali as partition", + ) partition: Literal[ "dali", "lgrandi", "xenon1t", "broadwl", "kicp", "caslake", "build" ] = Field("xenon1t", description="Partition to submit the job to") @@ -137,10 +141,6 @@ class JobSubmission(BaseModel): container: str = Field( "xenonnt-development.simg", description="Name of the container to activate" ) - bind: List[str] = Field( - default_factory=lambda: DEFAULT_BIND, - description="Paths to add to the container. Immutable when specifying dali as partition", - ) cpus_per_task: int = Field(1, description="CPUs requested for job") hours: Optional[float] = Field(None, description="Max hours of a job") node: Optional[str] = Field( From f70d566ae4bc42945ee6362c4f996012ca2169ef Mon Sep 17 00:00:00 2001 From: yuema137 <3124558229@qq.com> Date: Thu, 13 Jun 2024 14:04:56 -0500 Subject: [PATCH 3/4] bump version -> v0.8.5 --- .bumpversion.cfg | 2 +- utilix/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 26ec642..29c7da1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.8.4 +current_version = 0.8.5 files = setup.py utilix/__init__.py commit = True tag = True diff --git a/utilix/__init__.py b/utilix/__init__.py index e8c471b..2db640c 100644 --- a/utilix/__init__.py +++ b/utilix/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.8.4" +__version__ = "0.8.5" from . import config From caf1476d245c0ce3af1fb35f8e2fb52b4a66fd51 Mon Sep 17 00:00:00 2001 From: yuema137 <3124558229@qq.com> Date: Tue, 6 Aug 2024 13:35:18 -0500 Subject: [PATCH 4/4] print job id if submitted successfully --- utilix/batchq.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utilix/batchq.py b/utilix/batchq.py index 7ede33e..ba00a1b 100644 --- a/utilix/batchq.py +++ b/utilix/batchq.py @@ -475,8 +475,6 @@ def submit(self) -> None: # Add the job command slurm.add_cmd(self.jobstring) - print(f"Your log is located at: {self.log}") - # Handle dry run scenario if self.verbose or self.dry_run: print(f"Generated slurm script:\n{slurm.script()}") @@ -484,7 +482,16 @@ def submit(self) -> None: if self.dry_run: return # Submit the job - slurm.sbatch(shell="/bin/bash") + + try: + job_id = slurm.sbatch(shell="/bin/bash") + if job_id: + print(f"Job submitted successfully. Job ID: {job_id}") + print(f"Your log is located at: {self.log}") + else: + print("Job submission failed.") + except Exception as e: + print(f"An error occurred while submitting the job: {str(e)}") def submit_job(