def log_output(self, artifact): """ Log an artifact as an output of this execution. This method expects `artifact` to have - ARTIFACT_TYPE_NAME string field the form of <namespace>/<name>. - serialization() method to return a openapi_client.MlMetadataArtifact. This method will set artifact.id. """ self._log(artifact) output_event = openapi_client.MlMetadataEvent( artifact_id=artifact.id, execution_id=self.id, type=openapi_client.MlMetadataEventType.OUTPUT) self.workspace.client.create_event(output_event) return artifact
def log_input(self, artifact): """ Log an artifact as an input of this execution. This method expects `artifact` to have - ARTIFACT_TYPE_NAME string field the form of <namespace>/<name>. - serialization() method to return a openapi_client.MlMetadataArtifact. This method will set artifact.id. """ if artifact is None: raise ValueError("'artifact' must be set.") self._log(artifact) input_event = openapi_client.MlMetadataEvent( artifact_id=artifact.id, execution_id=self.id, type=openapi_client.MlMetadataEventType.INPUT ) self.workspace.client.create_event(input_event) return artifact