@@ -10,7 +10,7 @@ class MLManager(MlflowClient):
1010 A class for managing your MLFlow Runs/Experiments
1111 """
1212
13- def __init__ (self , _tracking_uri = 'http:// mlflow: 5001' ):
13+ def __init__ (self , _tracking_uri = MLManager . get_pod_uri ( " mlflow" , " 5001" ) ):
1414 mlflow .set_tracking_uri (_tracking_uri )
1515 print ("Tracking Model Metadata on MLFlow Server @ " + mlflow .get_tracking_uri ())
1616
@@ -22,6 +22,14 @@ def __init__(self, _tracking_uri='http://mlflow:5001'):
2222 self .active_run = None
2323 self .active_experiment = None
2424
25+ @staticmethod
26+ def get_pod_uri (pod , port , pod_count = 0 ):
27+ import os
28+ try :
29+ return '{pod}-{pod_count}-node.{framework}.mesos:{port}' .format (pod = pod , pod_count = pod_count , framework = os .environ ['FRAMEWORK_NAME' ], port = port )
30+ except KeyError as e :
31+ raise KeyError ("Uh Oh! FRAMEWORK_NAME variable was not found... are you running in Zeppelin?" )
32+
2533 @staticmethod
2634 def __removekey (d , key ):
2735 """
@@ -56,6 +64,13 @@ def create_new_run(self, user_id="splice"):
5664
5765 self .active_run = self .create_run (self .active_experiment .experiment_id , user_id = user_id )
5866
67+ def reset_run (self ):
68+ """
69+ Reset the current run (deletes logged parameters, metrics, artifacts etc.)
70+ """
71+ self .delete_run (self .active_run .info .run_uuid )
72+ self .create_new_run ()
73+
5974 def set_active_run (self , run_id ):
6075 """
6176 Set the active run to a previous run (allows you to log metadata for completed run)
0 commit comments