def launch_if_ready(self, task_id):
if self._count_deps(self.tasks[task_id]['<STR_LIT>']) == <NUM_LIT:0>:<EOL><INDENT>new_args, kwargs, exceptions = self.sanitize_and_wrap(task_id,<EOL>self.tasks[task_id]['<STR_LIT:args>'],<EOL>self.tasks[task_id]['<STR_LIT>'])<EOL>self.tasks[task_id]['<STR_LIT:args>'] = new_args<EOL>self.tasks[task_id]['<STR_LIT>'] = kwargs<EOL>if not exceptions:<EOL><INDENT>exec_fu = None<EOL>with self.tasks[task_id]['<STR_LIT>']:<EOL><INDENT>if self.tasks[task_id]['<STR_LIT:status>'] == States.pending:<EOL><INDENT>exec_fu = self.launch_task(<EOL>task_id, self.tasks[task_id]['<STR_LIT>'], *new_args, **kwargs)<EOL><DEDENT><DEDENT>if exec_fu:<EOL><INDENT>try:<EOL><INDENT>exec_fu.add_done_callback(partial(self.handle_exec_update, task_id))<EOL><DEDENT>except Exception as e:<EOL><INDENT>logger.error("<STR_LIT>".format(e))<EOL><DEDENT>self.tasks[task_id]['<STR_LIT>'] = exec_fu<EOL>try:<EOL><INDENT>self.tasks[task_id]['<STR_LIT>'].update_parent(exec_fu)<EOL>self.tasks[task_id]['<STR_LIT>'] = exec_fu<EOL><DEDENT>except AttributeError as e:<EOL><INDENT>logger.error(<EOL>"<STR_LIT>".format(task_id))<EOL>raise e<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>logger.info(<EOL>"<STR_LIT>".format(task_id))<EOL>self.tasks[task_id]['<STR_LIT:status>'] = States.dep_fail<EOL>if self.monitoring is not None:<EOL><INDENT>task_log_info = self._create_task_log_info(task_id, '<STR_LIT>')<EOL>self.monitoring.send(MessageType.TASK_INFO, task_log_info)<EOL><DEDENT>try:<EOL><INDENT>fu = Future()<EOL>fu.retries_left = <NUM_LIT:0><EOL>self.tasks[task_id]['<STR_LIT>'] = fu<EOL>self.tasks[task_id]['<STR_LIT>'].update_parent(fu)<EOL>fu.set_exception(DependencyError(exceptions,<EOL>task_id,<EOL>None))<EOL><DEDENT>except AttributeError as e:<EOL><INDENT>logger.error(<EOL>"<STR_LIT>".format(task_id))<EOL>raise e<EOL><DEDENT><DEDENT><DEDENT>
launch_if_ready will launch the specified task, if it is ready
to run (for example, without dependencies, and in pending state).

This should be called by any piece of the DataFlowKernel that
thinks a task may have become ready to run.

It is not an error to call launch_if_ready on a task that is not
ready to run - launch_if_ready will not incorrectly launch that
task.

launch_if_ready is thread safe, so may be called from any thread
or callback.