def process_jobs(self, ch, method, properties, jobrecord): ''' Work out dependancies and order ''' # Create a Job instance from the job record job = Job().load(jobrecord) # Register the job with the dispatcher self._register_job(job) self.log.info('Registered job: {0}'.format(job.state.id)) # Return registration success message to client _prop = pika.BasicProperties(correlation_id=properties.correlation_id) self.channel.basic_publish(exchange='', routing_key=properties.reply_to, properties=_prop, body=str(job.state.id)) # Work out the first tasks to run self.log.debug('Decomposing job; calculating first tasks to run') tasks_to_run = job.get_next_tasks_to_run() #This was added to fill out any id args in tasks right at the beginning for task in tasks_to_run: if task.state.args is not None: task = job.update_task_args(task) for task in tasks_to_run: task.state.status = 'SUBMITTED' self.publish_task(task.state.save())