From b36d9feec0f4c5d9d1f1e64253e953773fcc2c6e Mon Sep 17 00:00:00 2001 From: hategan Date: Fri, 28 Jul 2023 10:40:25 -0700 Subject: [PATCH] Added a simple check in `JobExecutor.submit()` to test if a job's executor property is already set (which would indicate that it was submitted before). --- src/psij/job_executor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/psij/job_executor.py b/src/psij/job_executor.py index c4cdc92b..babb46ee 100644 --- a/src/psij/job_executor.py +++ b/src/psij/job_executor.py @@ -105,6 +105,8 @@ def _check_job(self, job: Job) -> JobSpec: raise TypeError('environment key "%s" has non-string value (%s)' % (k, type(v).__name__)) + if job.executor is not None: + raise InvalidJobException('Job is already associated with an executor') job.executor = self return spec