Beispiel #1
0
def run_pipeline(pipeline, instance_id=None):
    try:
        api.get_model_inst()
        raise InvalidOperationException('This pipeline already started.')
    except:
        pass
    api.create_activity(modbpm_adapter.PipelineProcess, args=(pipeline, instance_id), identifier_code=pipeline.id)
Beispiel #2
0
 def target_for_sequence_flow(self, flow_id):
     flow_to_target = {
         c.sequence_flow.id: c.sequence_flow.target
         for c in self.conditions
     }
     if flow_id not in flow_to_target:
         raise InvalidOperationException(
             'sequence flow(%s) does not exist.' % flow_id)
     return flow_to_target[flow_id]
Beispiel #3
0
 def unique_one(self):
     """
     获取唯一的一个 flow,若当前集合内 flow 不只一条则抛出异常
     :return:
     """
     if len(self.flows) != 1:
         raise InvalidOperationException(
             'this collection contains multiple flow, can not get unique one.'
         )
     return self.flows[0]
Beispiel #4
0
 def modify_constants(self, constants):
     if self.enabled:
         raise InvalidOperationException(
             'can not modify constants when task is enabled')
     exec_data = self.execution_data
     for key, value in constants.items():
         if key in exec_data['constants']:
             exec_data['constants'][key]['value'] = value
     self.snapshot.data = exec_data
     self.snapshot.save()
     return exec_data['constants']
Beispiel #5
0
    def recover_variable(self):
        if self.raw_variables is None:
            raise InvalidOperationException(
                'make sure duplicate_variables() is called before do recover')

        # collect all act output key
        act_outputs_keys = set()
        for global_outputs in self.act_outputs.values():
            for output_key in global_outputs.values():
                act_outputs_keys.add(output_key)

        # recover to Variable for which key not in act output
        for key, var in self.raw_variables.items():
            if key not in act_outputs_keys:
                self.variables[key] = deepcopy(var)
Beispiel #6
0
 def modify_cron(self, cron, timezone=None):
     if self.enabled:
         raise InvalidOperationException(
             'can not modify cron when task is enabled')
     schedule, _ = CrontabSchedule.objects.get_or_create(
         minute=cron.get('minute', '*'),
         hour=cron.get('hour', '*'),
         day_of_week=cron.get('day_of_week', '*'),
         day_of_month=cron.get('day_of_month', '*'),
         month_of_year=cron.get('month_of_year', '*'),
         timezone=timezone or 'UTC')
     # try to initiate schedule object
     _ = schedule.schedule  # noqa
     self.cron = schedule.__str__()
     self.celery_task.crontab = schedule
     self.celery_task.save()
     self.save()
Beispiel #7
0
 def next(self):
     raise InvalidOperationException('can not determine next node for parallel gateway.')
Beispiel #8
0
 def skip(self):
     raise InvalidOperationException('can not skip conditional converge gateway.')
Beispiel #9
0
 def skip(self):
     raise InvalidOperationException('can not skip conditional parallel gateway.')