def merge(self): if self.node_type_operation is None: # the operation is not defined in the type # should be merged by the node template operation return self.node_template_operation if self.node_template_operation is None: # the operation is not defined in the template # should be merged by the node type operation # this will validate that all schema inputs have # default values return operation_mapping( implementation=self.node_type_operation['implementation'], inputs=merge_schema_and_instance_inputs( schema_inputs=self.node_type_operation['inputs'], instance_inputs={} ), executor=self.node_type_operation['executor'], max_retries=self.node_type_operation['max_retries'], retry_interval=self.node_type_operation['retry_interval'], timeout=self.node_type_operation['timeout'], timeout_recoverable=self.node_type_operation[ 'timeout_recoverable'] ) if self.node_template_operation == NO_OP: # no-op overrides return NO_OP if self.node_type_operation == NO_OP: # no-op overridden return self.node_template_operation merged_operation_implementation = self._derive_implementation() merged_operation_inputs = self._derive_inputs( merged_operation_implementation) merged_operation_executor = self._derive_executor( merged_operation_implementation) merged_operation_retries = self._derive_max_retries( merged_operation_implementation) merged_operation_retry_interval = self._derive_retry_interval( merged_operation_implementation) merged_operation_timeout = self._derive_timeout( merged_operation_implementation) merged_operation_timeout_recoverable = \ self._derive_timeout_recoverable(merged_operation_implementation) return operation_mapping( implementation=merged_operation_implementation, inputs=merged_operation_inputs, executor=merged_operation_executor, max_retries=merged_operation_retries, retry_interval=merged_operation_retry_interval, timeout=merged_operation_timeout, timeout_recoverable=merged_operation_timeout_recoverable )
def merge(self): if self.node_type_operation is None: # the operation is not defined in the type # should be merged by the node template operation return self.node_template_operation if self.node_template_operation is None: # the operation is not defined in the template # should be merged by the node type operation # this will validate that all schema inputs have # default values return operation_mapping( implementation=self.node_type_operation['implementation'], inputs=merge_schema_and_instance_inputs( schema_inputs=self.node_type_operation['inputs'], instance_inputs={} ), executor=self.node_type_operation['executor'], max_retries=self.node_type_operation['max_retries'], retry_interval=self.node_type_operation['retry_interval'], ) if self.node_template_operation == NO_OP: # no-op overrides return NO_OP if self.node_type_operation == NO_OP: # no-op overridden return self.node_template_operation merged_operation_implementation = self._derive_implementation() merged_operation_inputs = self._derive_inputs( merged_operation_implementation) merged_operation_executor = self._derive_executor( merged_operation_implementation) merged_operation_retries = self._derive_max_retries( merged_operation_implementation) merged_operation_retry_interval = self._derive_retry_interval( merged_operation_implementation) return operation_mapping( implementation=merged_operation_implementation, inputs=merged_operation_inputs, executor=merged_operation_executor, max_retries=merged_operation_retries, retry_interval=merged_operation_retry_interval )
def _derive_inputs(self, merged_operation_implementation): if merged_operation_implementation == \ self.node_type_operation['implementation']: # this means the node template inputs should adhere to # the node type inputs schema (since its the same implementation) merged_operation_inputs = merge_schema_and_instance_inputs( schema_inputs=self.node_type_operation['inputs'], instance_inputs=self.node_template_operation['inputs']) else: # the node template implementation overrides # the node type implementation. this means # we take the inputs defined in the node template merged_operation_inputs = \ self.node_template_operation['inputs'] return merged_operation_inputs
def _derive_inputs(self, merged_operation_implementation): if merged_operation_implementation == \ self.node_type_operation['implementation']: # this means the node template inputs should adhere to # the node type inputs schema (since its the same implementation) merged_operation_inputs = merge_schema_and_instance_inputs( schema_inputs=self.node_type_operation['inputs'], instance_inputs=self.node_template_operation['inputs'] ) else: # the node template implementation overrides # the node type implementation. this means # we take the inputs defined in the node template merged_operation_inputs = \ self.node_template_operation['inputs'] return merged_operation_inputs