def execute(self): exp_id = self.id self.duplicate() self.is_run = True self.parent_exp_id = exp_id self.working() self.log("root", "Experiment started") auto_exec_task.s(self, "root", is_init=True).apply_async()
def do_action(self, action_name, exp, *args, **kwargs): # if action_name == "success" and self.block_base_name == "CROSS_VALID": # from celery.contrib import rdb; rdb.set_trace() ar = self._trans.action_records_by_name[action_name] old_exec_state = self.get_exec_status() next_state = self._trans.next_state(self.state, action_name) if next_state is not None: log.debug("Do action: %s in block %s from state %s -> %s", action_name, self.base_name, self.state, next_state) exp.log( self.uuid, "Do action: %s in block %s from state %s -> %s" % (action_name, self.base_name, self.state, next_state)) self.state = next_state if old_exec_state != "done" and self.get_exec_status() == "done": if self.is_block_supports_auto_execution: BlockUpdated(self.exp_id, block_uuid=self.uuid, block_alias=self.base_name, silent=True).send() exp.store_block(self) getattr(self, action_name)(exp, *args, **kwargs) if ar.reload_block_in_client: BlockUpdated(self.exp_id, self.uuid, self.base_name).send() # TODO: Check if self.scope_name is actually set to auto execution # if old_exec_state != "done" and self.get_exec_status() == "done" \ and ar.propagate_auto_execution \ and self.is_block_supports_auto_execution: exp.log(self.uuid, "Propagate execution: %s " % self.base_name) log.debug("Propagate execution: %s ", self.base_name) auto_exec_task.s(exp, self.scope_name).apply_async() elif self.state in self.auto_exec_status_error \ and self.is_block_supports_auto_execution: exp.log(self.uuid, "Detected error during automated workflow execution") log.debug("Detected error during automated workflow execution") halt_execution_task.s(exp, self.scope_name).apply_async() else: raise RuntimeError( "Action %s isn't available for block %s in state %s" % (action_name, self.base_name, self.state))
def do_action(self, action_name, exp, *args, **kwargs): # if action_name == "success" and self.block_base_name == "CROSS_VALID": # from celery.contrib import rdb; rdb.set_trace() ar = self._trans.action_records_by_name[action_name] old_exec_state = self.get_exec_status() next_state = self._trans.next_state(self.state, action_name) if next_state is not None: log.debug("Do action: %s in block %s from state %s -> %s", action_name, self.base_name, self.state, next_state) exp.log(self.uuid, "Do action: %s in block %s from state %s -> %s" % (action_name, self.base_name, self.state, next_state)) self.state = next_state if old_exec_state != "done" and self.get_exec_status() == "done": if self.is_block_supports_auto_execution: BlockUpdated(self.exp_id, block_uuid=self.uuid, block_alias=self.base_name, silent=True).send() exp.store_block(self) getattr(self, action_name)(exp, *args, **kwargs) if ar.reload_block_in_client: BlockUpdated(self.exp_id, self.uuid, self.base_name).send() # TODO: Check if self.scope_name is actually set to auto execution # if old_exec_state != "done" and self.get_exec_status() == "done" \ and ar.propagate_auto_execution \ and self.is_block_supports_auto_execution: exp.log(self.uuid, "Propagate execution: %s " % self.base_name) log.debug("Propagate execution: %s ", self.base_name) auto_exec_task.s(exp, self.scope_name).apply_async() elif self.state in self.auto_exec_status_error \ and self.is_block_supports_auto_execution: exp.log(self.uuid, "Detected error during automated workflow execution") log.debug("Detected error during automated workflow execution") halt_execution_task.s(exp, self.scope_name).apply_async() else: raise RuntimeError("Action %s isn't available for block %s in state %s" % (action_name, self.base_name, self.state))
def execute(self): auto_exec_task.s(self, "root", is_init=True).apply_async()