Пример #1
0
    def __init__(self, parent=None):
        Observable.__init__(self)

        if type(self) == StateElement:
            raise NotImplementedError

        self.parent = parent
Пример #2
0
    def __init__(self):
        Observable.__init__(self)
        self._full_history = []
        self._current_history_element = None

        # insert initial dummy element
        self.insert_action(ActionDummy())
Пример #3
0
    def __init__(self, root_state=None, version=None, creation_time=None, last_update=None, state_machine_id=None):
        Observable.__init__(self)

        self._modification_lock = RLock()

        if state_machine_id is None:
            self.state_machine_id = generate_state_machine_id()
        else:
            self.state_machine_id = state_machine_id

        if root_state:
            self.root_state = root_state

        if version:
            self.version = version

        if creation_time:
            self.creation_time = creation_time
        else:
            self.creation_time = get_current_time_string()

        # this case happens if old state machines are loaded which do not have statemachine.json yet
        if isinstance(last_update, datetime):
            # see https://stackoverflow.com/questions/8022161/python-converting-from-datetime-datetime-to-time-time
            last_update = time.mktime(last_update.timetuple()) + last_update.microsecond / 1E6

        if last_update:
            self.last_update = last_update
        else:
            self.last_update = get_current_time_string()

        self._execution_histories = []

        # specifies if this state machine supports saving states with state_name + state_id
        self._supports_saving_state_names = True
Пример #4
0
 def __init__(self):
     Observable.__init__(self)
     self.__global_variable_dictionary = {}
     self.__global_variable_type_dictionary = {}
     self.__variable_locks = {}
     self.__global_lock = RLock()
     self.__access_keys = {}
     self.__variable_references = {}
Пример #5
0
    def __init__(self, state_machines=None):
        Observable.__init__(self)

        self._state_machines = {}

        if state_machines is not None:
            for state_machine in state_machines:
                self.add_state_machine(state_machine)
Пример #6
0
    def __init__(self, execution_mode=None):

        Observable.__init__(self)

        # these fields are not supposed to be written by the GUI directly, but via the methods of the
        # StateMachineExecutionEngine class
        self._execution_mode = None
        self.execution_mode = execution_mode
        logger.debug("State machine status is set to %s" % str(execution_mode))
        self.execution_condition_variable = CustomCondition()
Пример #7
0
    def __init__(self, parent=None, safe_init=True):
        Observable.__init__(self)

        if type(self) == StateElement:
            raise NotImplementedError

        if safe_init:
            StateElement._safe_init(self, parent)
        else:
            StateElement._unsafe_init(self, parent)
Пример #8
0
    def __init__(self):
        Observable.__init__(self)

        self.model_copies = {state_element_attr: [] for state_element_attr in ContainerState.state_element_attrs}

        self.copy_parent_state_id = None
        self.outcome_id_mapping_dict = {}
        self.port_id_mapping_dict = {}
        # TODO check if it is secure that new state ids don't interfere with old state ids
        self.state_id_mapping_dict = {}
        self.semantic_data_list_tuple = []
Пример #9
0
    def __init__(self, state_machine_manager):
        Observable.__init__(self)
        self.state_machine_manager = state_machine_manager
        self._status = ExecutionStatus(StateMachineExecutionStatus.STOPPED)
        logger.debug("State machine execution engine initialized")
        self.start_state_paths = []

        self.execution_engine_lock = Lock()
        self._run_to_states = []
        self.run_to_states = []
        self.state_machine_running = False
        self.synchronization_counter = 0
        self.synchronization_lock = Lock()
Пример #10
0
    def __init__(self, path=None, filename=None, parent=None):

        Observable.__init__(self)
        self._path = None
        self._filename = None
        self._compiled_module = None
        self._script_id = generate_script_id()
        self._parent = None

        self.script = DEFAULT_SCRIPT
        self.filename = filename
        if path:
            self.path = path
        self.parent = parent
Пример #11
0
    def __init__(self):
        Observable.__init__(self)
        self._libraries = {}
        self._library_root_paths = {}
        logger.debug("Initializing Storage object ...")
        # a list to hold all library state already manually replaced by the user
        self._replaced_libraries = {}
        # a list to hold all library states that were skipped by the user during the replacement procedure
        self._skipped_states = []
        self._skipped_library_roots = []

        # loaded libraries
        self._loaded_libraries = {}
        self._libraries_instances = {}
Пример #12
0
    def __init__(self, path=None, filename=None, check_path=True, parent=None):

        Observable.__init__(self)
        self._path = None
        self._filename = None
        self._compiled_module = None
        self._script_id = generate_script_id()
        self._parent = None
        self._check_path = check_path

        self._script = DEFAULT_SCRIPT
        self.filename = filename
        if path:
            self.load_script_from_path_and_take_over_path(
                path, with_build_module=True)
        self.parent = parent
Пример #13
0
    def __init__(self, state_machine_manager):
        Observable.__init__(self)
        self.state_machine_manager = state_machine_manager
        self._status = ExecutionStatus(StateMachineExecutionStatus.STOPPED)
        logger.debug("State machine execution engine initialized")
        self.start_state_paths = []

        self.execution_engine_lock = Lock()
        self._run_to_states = []
        self.run_to_states = []
        self.state_machine_running = False
        # the thread, that wants to synchronize, has to acquire the self._status.execution_condition_variable
        # then it can read or set the synchronization_counter; this is only relevant for tests
        self.synchronization_counter = 0
        # counts how often a state asks for the current execution status
        self.state_counter = 0
        self.state_counter_lock = Lock()
Пример #14
0
 def __init__(self, default_config_filename, logger_object=None):
     DefaultConfig.__init__(self,
                            default_config_filename,
                            logger_object,
                            rel_config_path='rafcon')
     Observable.__init__(self)
Пример #15
0
    def __init__(self, name=None, data_type=None, default_value=None, scoped_variable_id=None, parent=None,
                 safe_init=True):

        Observable.__init__(self)

        DataPort.__init__(self, name, data_type, default_value, scoped_variable_id, parent, safe_init=safe_init)
Пример #16
0
 def __init__(self):
     Observable.__init__(self)
     self.__first_var = None
     self.observable_test_var = 0