datasetinsights.io.tracker¶
datasetinsights.io.tracker.factory¶
-
class
datasetinsights.io.tracker.factory.NullTracker¶ Bases:
objectA null tracker that writes nothing. This tracker is used to disable tracking.
-
class
datasetinsights.io.tracker.factory.TrackerFactory¶ Bases:
objectFactory: responsible for creating and holding singleton instance of tracker classes
-
HOST_ID= 'host'¶
-
MLFLOW_TRACKER= 'mlflow'¶
-
RUN_FAILED= 'FAILED'¶
-
TRACKER= 'tracker'¶
-
static
create(config=None, tracker_type=None)¶ create tracker class object.
- Parameters
config – config object, holds server details
tracker_type – type of tracker
- Returns
tracker instance.
-
datasetinsights.io.tracker.mlflow¶
-
class
datasetinsights.io.tracker.mlflow.MLFlowTracker(mlflow_config)¶ Bases:
object- MlFlow tracker class, responsible for setting host, client_id and return
initialized mlflow. It also refreshes the access token through daemon thread.
Examples
# Set MLTracking server UI, default is local file
>>> mlflow.set_tracking_uri(TRACKING_URI) # New run is launched under the current experiment >>> mlflow.start_run() # Log a parameter (key-value pair) >>> mlflow.log_param("param_name", "param_value") # Log a metric (key-value pair) >>> mlflow.log_metric("metric_name", "metric_val") # Log an artifact (output file) >>> with open("output.txt", "w") as f: >>> f.write("Hello world!") >>> mlflow.log_artifact("output.txt", "run1/output/") # ends the run launched under the current experiment >>> mlflow.end_run()
-
REFRESH_INTERVAL¶ default refresh token interval
-
__mlflow¶ holds initialized mlflow
-
CLIENT_ID= 'client_id'¶
-
DEFAULT_RUN_NAME= 'run-20210222-210309'¶
-
EXP_NAME= 'experiment'¶
-
HOST_ID= 'host'¶
-
REFRESH_INTERVAL= 3000¶
-
RUN_NAME= 'run'¶
-
get_mlflow()¶ method to access initialized mlflow :returns: Initialized __mlflow instance.
-
class
datasetinsights.io.tracker.mlflow.RefreshTokenThread(client_id, interval=3000)¶ Bases:
threading.Thread- Its service thread which keeps running till main thread runs
and refresh access tokens.
-
client_id¶ MLFlow tracking server client id
-
interval¶ duration at which it refreshes the token
-
run()¶ Thread run method which keeps running at specified interval till main thread runs.
-
class
datasetinsights.io.tracker.MLFlowTracker(mlflow_config)¶ Bases:
object- MlFlow tracker class, responsible for setting host, client_id and return
initialized mlflow. It also refreshes the access token through daemon thread.
Examples
# Set MLTracking server UI, default is local file
>>> mlflow.set_tracking_uri(TRACKING_URI) # New run is launched under the current experiment >>> mlflow.start_run() # Log a parameter (key-value pair) >>> mlflow.log_param("param_name", "param_value") # Log a metric (key-value pair) >>> mlflow.log_metric("metric_name", "metric_val") # Log an artifact (output file) >>> with open("output.txt", "w") as f: >>> f.write("Hello world!") >>> mlflow.log_artifact("output.txt", "run1/output/") # ends the run launched under the current experiment >>> mlflow.end_run()
-
REFRESH_INTERVAL¶ default refresh token interval
-
__mlflow¶ holds initialized mlflow
-
CLIENT_ID= 'client_id'¶
-
DEFAULT_RUN_NAME= 'run-20210222-210309'¶
-
EXP_NAME= 'experiment'¶
-
HOST_ID= 'host'¶
-
REFRESH_INTERVAL= 3000¶
-
RUN_NAME= 'run'¶
-
get_mlflow()¶ method to access initialized mlflow :returns: Initialized __mlflow instance.