def __create_handler(self, name, meta, description, source_type, source_code, version): _logger.info("[%s]: Creating.", name) # TODO(dustin): We might also want to require "test" arguments and a test # result, for unit-tests. handler_type = meta['handler_type'] expected_arguments = meta['argument_spec'] extra_argument_spec = self.__get_extra_arguments_spec(handler_type) expected_arguments += extra_argument_spec handler = mr.models.kv.handler.Handler( workflow_name=self.__workflow.workflow_name, handler_name=name, description=description, argument_spec=expected_arguments, source_type=source_type, source_code=source_code, version=version, handler_type=handler_type, required_capability=meta['required_capability']) self.__validate_handler(handler) if self.__simulate_only is False: handler.save()
def __update_handler(self, handler, meta, description, source_type, source_code, version): _logger.info("[%s]: Updating.", handler.handler_name) # TODO(dustin): We might also want to require "test" arguments and a test # result, for unit-tests. handler_type = meta['handler_type'] expected_arguments = meta['argument_spec'] extra_argument_spec = self.__get_extra_arguments_spec(handler_type) expected_arguments += extra_argument_spec handler.description = description handler.argument_spec = expected_arguments handler.source_type = source_type handler.source_code = source_code handler.version = version handler.handler_type = handler_type handler.required_capability = meta['required_capability'] self.__validate_handler(handler) if self.__simulate_only is False: handler.save()