def to_flyte_idl(self): """ :rtype: flyteidl.core.tasks_pb2.TaskTemplate """ return _core_task.TaskTemplate( id=self.id.to_flyte_idl(), type=self.type, metadata=self.metadata.to_flyte_idl(), interface=self.interface.to_flyte_idl(), custom=_json_format.Parse(_json.dumps(self.custom), _struct.Struct()) if self.custom else None, container=self.container.to_flyte_idl() if self.container else None )
def test_hydrate_registration_parameters__task_nothing_set(): task = _task_pb2.TaskSpec( template=_core_task_pb2.TaskTemplate( id=_identifier_pb2.Identifier(resource_type=_identifier_pb2.TASK, name="name",), ) ) identifier, entity = hydrate_registration_parameters(task.template.id, "project", "domain", "12345", task) assert ( identifier == _identifier_pb2.Identifier( resource_type=_identifier_pb2.TASK, project="project", domain="domain", name="name", version="12345", ) == entity.template.id )
def to_flyte_idl(self): """ :rtype: flyteidl.core.tasks_pb2.TaskTemplate """ task_template = _core_task.TaskTemplate( id=self.id.to_flyte_idl(), type=self.type, metadata=self.metadata.to_flyte_idl(), interface=self.interface.to_flyte_idl(), custom=_json_format.Parse(_json.dumps( self.custom), _struct.Struct()) if self.custom else None, container=self.container.to_flyte_idl() if self.container else None, task_type_version=self.task_type_version, security_context=self.security_context.to_flyte_idl() if self.security_context else None, config={k: v for k, v in self.config.items()} if self.config is not None else None, ) return task_template