3
3
import time
4
4
5
5
from mlflow import MlflowClient
6
- from mlflow .entities import Run
7
- from mlflow .entities .model_registry import ModelVersion , RegisteredModel , Experiment
6
+ from mlflow .entities import Run , Experiment
7
+ from mlflow .entities .model_registry import ModelVersion , RegisteredModel
8
8
from mlflow .store .entities import PagedList
9
9
from pydantic .fields import Field
10
10
45
45
DataProcessInstanceRunResultClass ,
46
46
DataProcessInstanceOutputClass ,
47
47
)
48
- from datahub .metadata .urns import DatasetUrn , DataPlatformUrn , MlModelUrn , MlModelGroupUrn , DataProcessInstanceUrn , DataPlatformInstanceUrn
48
+ from datahub .metadata .urns import (
49
+ DatasetUrn ,
50
+ DataPlatformUrn ,
51
+ MlModelUrn ,
52
+ MlModelGroupUrn ,
53
+ DataProcessInstanceUrn ,
54
+ DataPlatformInstanceUrn ,
55
+ )
49
56
from datahub .api .entities .dataprocess .dataprocess_instance import (
50
57
DataProcessInstance ,
51
58
InstanceRunResult ,
@@ -213,14 +220,16 @@ def _get_experiment_container_workunit(
213
220
experiment_container = Container (
214
221
key = ContainerKeyWithId (
215
222
platform = str (DataPlatformUrn .create_from_id ("mlflow" )),
216
- id = experiment .name
223
+ id = experiment .name ,
217
224
),
218
225
subtype = "ML Experiment" ,
219
226
name = experiment .name ,
220
227
description = experiment .tags .get ("mlflow.note.content" ),
221
228
) # TODO: this generates a urn as guid, should we change this to use experiment.id?
222
229
223
- print ("experiment.key.id:" , experiment .key .id ) # this should be same as container key as urn
230
+ print (
231
+ "experiment.key.id:" , experiment .key .id
232
+ ) # this should be same as container key as urn
224
233
print ("experiment.key.as_urn(): " , experiment .key .as_urn ())
225
234
226
235
workunits = [mcp .as_workunit () for mcp in experiment .generate_mcp ()]
@@ -298,9 +307,7 @@ def _get_run_workunits(
298
307
workunits .append (
299
308
MetadataChangeProposalWrapper (
300
309
entityUrn = str (data_process_instance .urn ),
301
- aspect = DataProcessInstanceOutputClass (
302
- outputs = [model_version_urn ]
303
- ),
310
+ aspect = DataProcessInstanceOutputClass (outputs = [model_version_urn ]),
304
311
).as_workunit ()
305
312
)
306
313
@@ -323,7 +330,6 @@ def _get_run_workunits(
323
330
) # TODO: this should be SUCCESS, SKIPPED, FAILURE, UP_FOR_RETRY
324
331
duration_millis = run .info .end_time - run .info .start_time
325
332
326
-
327
333
if run .info .end_time :
328
334
workunits .append (
329
335
MetadataChangeProposalWrapper (
@@ -357,7 +363,7 @@ def _get_run_workunits(
357
363
created = AuditStampClass (
358
364
time = created_time ,
359
365
actor = created_actor ,
360
- )
366
+ ),
361
367
),
362
368
).as_workunit ()
363
369
)
0 commit comments