178 def assign_arguments(self, job):
179 """
180 Use the `arguments_generator` (if one exists) to assign the argument tuples to the
181 subjobs.
182 """
183 if self.arguments_generator:
184 arg_gen = self.arguments_generator.generator
185 generating = True
186 for subjob in sorted(job.subjobs.values(), key=lambda sj: sj.id):
187 if generating:
188 try:
189 args = arg_gen.send(subjob)
190 except StopIteration:
191 B2ERROR(f"StopIteration called when getting args for {subjob}, "
192 "setting all subsequent subjobs to have empty argument tuples.")
193 args = tuple()
194 generating = False
195 else:
196 args = tuple()
197 B2DEBUG(29, f"Arguments for {subjob}: {args}")
198 subjob.args = args
199 return
200
201 B2INFO(f"No ArgumentsGenerator assigned to the {self} so subjobs of {job} "
202 "won't automatically have arguments assigned.")
203