fix: job_id is an int

This commit is contained in:
Dominik Moritz Roth 2023-07-07 15:27:16 +02:00
parent 5e8d6d2552
commit 73b974458b

View File

@ -124,13 +124,15 @@ class Slate():
def _reps_for_job(self, schedulerC, job_id):
reps = schedulerC.get('repetitions', 1)
if job_id == None:
return range(0, reps)
num_jobs = self._calc_num_jobs(schedulerC)
reps_for_job = [[]] * num_jobs
for i in range(reps):
reps_for_job[i % num_jobs].append(i)
return reps_for_job[job_id]
def run_local(self, filename, name, job_id=0):
def run_local(self, filename, name, job_id):
config = self.load_config(filename, name)
schedulerC = copy.deepcopy(config.get('scheduler', {}))
rep_ids = self._reps_for_job(schedulerC, job_id)
@ -245,7 +247,7 @@ class Slate():
parser.add_argument("experiment", nargs='?', default='DEFAULT')
parser.add_argument("-s", "--slurm", action="store_true")
parser.add_argument("-w", "--worker", action="store_true")
parser.add_argument("-j", "--job_id", default=0)
parser.add_argument("-j", "--job_id", default=None, type=int)
args = parser.parse_args()