Run

traceml.tracking.run.Run(owner=None, project=None, run_uuid=None, client=None, track_code=True, track_env=True, track_logs=True, refresh_data=False, artifacts_path=None, collect_artifacts=None, collect_resources=None, is_new=None, is_offline=None, no_op=None, name=None, description=None, tags=None, auto_create=True)

Run tracking is client to instrument your machine learning model and track experiments.

If no values are passed to this class, Polyaxon will try to resolve the owner, project, and run uuid from the environment:

  • If you have a configured CLI, Polyaxon will use the configuration of the cli.
  • If you have a cached run using the CLI, the client will default to that cached run unless you override the values.
  • If you use this client in the context of a job or a service managed by Polyaxon, a configuration will be available to resolve the values based on that run.

You can always access the self.client to execute more APIs.

  • Properties:

    • project: str.
    • owner: str.
    • run_uuid: str.
    • run_data: V1Run.
    • status: str.
    • namespace: str.
    • client: PolyaxonClient
  • Args:

    • owner: str, optional, the owner is the username or the organization name owning this project.
    • project: str, optional, project name owning the run(s).
    • run_uuid: str, optional, run uuid.
    • client: PolyaxonClient, optional, an instance of a configured client, if not passed, a new instance will be created based on the available environment.
    • track_code: bool, optional, default True, to track code version. Polyaxon will try to track information about any repo configured in the context where this client is instantiated.
    • track_env: bool, optional, default True, to track information about the environment.
    • track_logs: bool, optional, default True, to track logs for manually managed runs.
    • refresh_data: bool, optional, default False, to refresh the run data at instantiation.
    • artifacts_path: str, optional, for in-cluster runs it will be set automatically.
    • collect_artifacts: bool, optional, similar to the env var flag POLYAXON_COLLECT_ARTIFACTS, this env var is True by default for managed runs and is controlled by the plugins section.
    • collect_resources: bool, optional, similar to the env var flag POLYAXON_COLLECT_RESOURCES, this env var is True by default for managed runs and is controlled by the plugins section.
    • is_new: bool, optional, Force the creation of a new run instead of trying to discover a cached run or refreshing an instance from the env var
    • is_offline: bool, optional, To trigger the offline mode manually instead of depending on POLYAXON_IS_OFFLINE.
    • no_op: bool, optional, To set the NO_OP mode manually instead of depending on POLYAXON_NO_OP.
    • name: str, optional, When is_new or is_offline is set to true, a new instance is created and you can initialize that new run with a name.
    • description: str, optional, When is_new or is_offline is set to true, a new instance is created and you can initialize that new run with a description.
    • tags: str or List[str], optional, When is_new or is_offline is set to true, a new instance is created and you can initialize that new run with tags.
  • Raises:

    • PolyaxonClientException: If no owner and/or project are passed and Polyaxon cannot resolve the values from the environment.

get_tensorboard_path

get_tensorboard_path(self, rel_path='tensorboard', use_store_path=False)

Returns a tensorboard path for this run relative to the outputs path.

If use_store_path is enabled, the path returned will be relative to the artifacts store path and not Polyaxon’s context. Please note that, the library will not ensure that the path exists when this flag is set to true.

  • Args:
    • rel_path: str, optional, default “tensorboard”, the relative path to the outputs context.
    • use_store_path: bool, default False.
  • Returns: str, outputs_path/rel_path

get_outputs_path

get_outputs_path(self, rel_path=None, ensure_path=True, is_dir=False, use_store_path=False)

Get the absolute outputs path of the specified artifact in the currently active run.

If rel_path is specified, the outputs artifact root path of the currently active run will be returned: root_run_artifacts_path/outputs/rel_path. If rel_path is not specified, the current root artifacts path configured for this instance will be returned: root_run_artifacts_path/outputs.

If ensure_path is provided, the path will be created. By default the path will be created until the last part of the rel_path argument, if is_dir is True, the complete rel_path is created.

If use_store_path is enabled, the path returned will be relative to the artifacts store path and not Polyaxon’s context. Please note that, the library will not ensure that the path exists when this flag is set to true.

  • Args:
    • rel_path: str, optional.
    • ensure_path: bool, optional, default True.
    • is_dir: bool, optional, default False.
    • use_store_path: bool, default False.
  • Returns: str, outputs_path

get_artifacts_path

get_artifacts_path(self, rel_path=None, ensure_path=False, is_dir=False, use_store_path=False)

Get the absolute path of the specified artifact in the currently active run.

If rel_path is specified, the artifact root path of the currently active run will be returned: root_run_artifacts_path/rel_path. If rel_path is not specified, the current root artifacts path configured for this instance will be returned: root_run_artifacts_path.

If ensure_path is provided, the path will be created. By default the path will be created until the last part of the rel_path argument, if is_dir is True, the complete rel_path is created.

If use_store_path is enabled, the path returned will be relative to the artifacts store path and not Polyaxon’s context. Please note that, the library will not ensure that the path exists when this flag is set to true.

  • Args:
    • rel_path: str, optional.
    • ensure_path: bool, optional, default True.
    • is_dir: bool, optional, default False.
    • use_store_path: bool, default False.
  • Returns: str, artifacts_path

log_metric

log_metric(self, name, value, step=None, timestamp=None)

Logs a metric datapoint.

log_metric(name="loss", value=0.01, step=10)

Note: It’s very important to log step as one of your metrics if you want to compare experiments on the dashboard and use the steps in x-axis instead of timestamps.

Note: To log multiple metrics at once you can use log_metrics.

  • Args:
    • name: str, metric name
    • value: float, metric value
    • step: int, optional
    • timestamp: datetime, optional

log_metrics

log_metrics(self, step=None, timestamp=None)

Logs multiple metrics.

log_metrics(step=123, loss=0.023, accuracy=0.91)

Note: It’s very important to log step as one of your metrics if you want to compare experiments on the dashboard and use the steps in x-axis instead of timestamps.

  • Args:
    • step: int, optional
    • timestamp: datetime, optional
    • metrics: kwargs, key=value

log_image

log_image(self, data, name=None, step=None, timestamp=None, rescale=1, dataformats='CHW', ext=None)

Logs an image.

log_image(data="path/to/image.png", step=10)
log_image(data=np_array, name="generated_image", step=10)
  • Args:
    • data: str or numpy.array, a file path or numpy array
    • name: str, name of the image, if a path is passed this can be optional and the name of the file will be used
    • step: int, optional
    • timestamp: datetime, optional
    • rescale: int, optional
    • dataformats: str, optional
    • ext: str, optional, default extension to use, note that if you pass a file polyaxon will automatically guess the extension

log_image_with_boxes

log_image_with_boxes(self, tensor_image, tensor_boxes, name=None, step=None, timestamp=None, rescale=1, dataformats='CHW')

Logs an image with bounding boxes.

log_image_with_boxes(
    name="my_image",
    tensor_image=np.arange(np.prod((3, 32, 32)), dtype=float).reshape((3, 32, 32)),
    tensor_boxes=np.array([[10, 10, 40, 40]]),
)
  • Args:
    • tensor_image: numpy.array or str: Image data or file name
    • tensor_boxes: numpy.array or str: Box data (for detected objects) box should be represented as [x1, y1, x2, y2]
    • name: str, name of the image
    • step: int, optional
    • timestamp: datetime, optional
    • rescale: int, optional
    • dataformats: str, optional

log_mpl_image

log_mpl_image(self, data, name=None, close=True, step=None, timestamp=None)

Logs a matplotlib image.

log_mpl_image(name="figure", data=figure, step=1, close=False)
  • Args:
    • data: matplotlib.pyplot.figure or List[matplotlib.pyplot.figure]
    • name: sre, optional, name
    • close: bool, optional, default True
    • step: int, optional
    • timestamp: datetime, optional

log_video

log_video(self, data, name=None, fps=4, step=None, timestamp=None, content_type=None)

Logs a video.

log_video("path/to/my_video1"),
log_video(
    name="my_vide2",
    data=np.arange(np.prod((4, 3, 1, 8, 8)), dtype=float).reshape((4, 3, 1, 8, 8))
)
  • Args:
    • data: video data or str.
    • name: str, optional, if data is a filepath the name will be the name of the file
    • fps: int, optional, frames per second
    • step: int, optional
    • timestamp: datetime, optional
    • content_type: str, optional, default “gif”

log_audio

log_audio(self, data, name=None, sample_rate=44100, step=None, timestamp=None, content_type=None)

Logs a audio.

log_audio("path/to/my_audio1"),
log_audio(name="my_audio2", data=np.arange(np.prod((42,)), dtype=float).reshape((42,)))
  • Args:
    • data: str or audio data
    • name: str, optional, if data is a filepath the name will be the name of the file
    • sample_rate: int, optional, sample rate in Hz
    • step: int, optional
    • timestamp: datetime, optional
    • content_type: str, optional, default “wav”

log_text

log_text(self, name, text, step=None, timestamp=None)

Logs a text.

log_text(name="text", text="value")
  • Args:
    • name: str, name
    • text: str, text value
    • step: int, optional
    • timestamp: datetime, optional

log_html

log_html(self, name, html, step=None, timestamp=None)

Logs an html.

log_html(name="text", html="<p>value</p>")
  • Args:
    • name: str, name
    • html: str, text value
    • step: int, optional
    • timestamp: datetime, optional

log_np_histogram

log_np_histogram(self, name, values, counts, step=None, timestamp=None)

Logs a numpy histogram.

values, counts = np.histogram(np.random.randint(255, size=(1000,)))
log_np_histogram(name="histo1", values=values, counts=counts, step=1)
  • Args:
    • name: str, name
    • values: np.array
    • counts: np.array
    • step: int, optional
    • timestamp: datetime, optional

log_histogram

log_histogram(self, name, values, bins, max_bins=None, step=None, timestamp=None)

Logs a histogram.

log_histogram(
    name="histo",
    values=np.arange(np.prod((1024,)), dtype=float).reshape((1024,)),
    bins="auto",
    step=1
)
  • Args:
    • name: str, name
    • values: np.array
    • bins: int or str
    • max_bins: int, optional
    • step: int, optional
    • timestamp: datetime, optional

log_model

log_model(self, path, name=None, framework=None, summary=None, step=None, timestamp=None, rel_path=None, skip_hash_calculation=False)

Logs a model or a versioned model if a step value is provided.

This method will:

  • save the model
  • several versions of the model and create an event file if the step is provided.

Note 1: This method does a couple of things:

  • It moves the model under the outputs or the assets directory if the step is provided
  • If the step is provided it creates an event file
  • It creates a lineage reference to the model or to the event file if the step is provided

Note 2: If you need to have more control over where the model should be saved and only record a lineage information of that path you can use log_model_ref.

  • Args:
    • path: str, path to the model to log.
    • name: str, name to give to the model.
    • framework: str, optional ,name of the framework.
    • summary: Dict, optional, key, value information about the model.
    • step: int, optional
    • timestamp: datetime, optional
    • rel_path: str, relative path where to store the model.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation.

log_dataframe

log_dataframe(self, df, name, content_type='csv', step=None, timestamp=None)

Logs a dataframe.

  • Args:
    • df: the dataframe to save
    • name: str, optional, if not provided the name of the file will be used.
    • content_type: str, optional, csv or html.
    • step: int, optional
    • timestamp: datetime, optional

log_artifact

log_artifact(self, path, name=None, kind=None, summary=None, step=None, timestamp=None, rel_path=None, skip_hash_calculation=False)

Logs a generic artifact or a versioned generic artifact if a step value is provided.

This method will:

  • save the artifact
  • several versions of the artifact and create an event file if the step is provided.

Note 1: This method does a couple things:

  • It moves the artifact under the outputs or the assets directory if the step is provided
  • If the step is provided it creates an event file
  • It creates a lineage reference to the artifact or to the event file if the step is provided

Note 2: If you need to have more control over where the artifact should be saved and only record a lineage information of that path you can use log_artifact_ref.

  • Args:
    • path: str, path to the artifact.
    • name: str, optional, if not provided the name of the file will be used.
    • kind: optional, str
    • summary: Dict, optional, additional summary information to log about data in the lineage table.
    • step: int, optional
    • timestamp: datetime, optional
    • rel_path: str, relative path where to store the artifacts.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation

log_roc_auc_curve

log_roc_auc_curve(self, name, fpr, tpr, auc=None, step=None, timestamp=None)

Logs ROC/AUC curve. This method expects an already processed values.

log_roc_auc_curve("roc_value", fpr, tpr, auc=0.6, step=1)
  • Args:
    • name: str, name of the curve
    • fpr: List[float] or numpy.array, false positive rate
    • tpr: List[float] or numpy.array, true positive rate
    • auc: float, optional, calculated area under curve
    • step: int, optional
    • timestamp: datetime, optional

log_sklearn_roc_auc_curve

log_sklearn_roc_auc_curve(self, name, y_preds, y_targets, step=None, timestamp=None, is_multi_class=False)

Calculates and logs ROC/AUC curve using sklearn.

log_sklearn_roc_auc_curve("roc_value", y_preds, y_targets, step=10)

If you are logging a multi-class roc curve, you should set is_multi_class=True to allow persisting curves for all classes.

  • Args:
    • name: str, name of the curve
    • y_preds: List[float] or numpy.array
    • y_targets: List[float] or numpy.array
    • step: int, optional
    • timestamp: datetime, optional
    • is_multi_class: bool, optional

log_pr_curve

log_pr_curve(self, name, precision, recall, average_precision=None, step=None, timestamp=None)

Logs PR curve. This method expects an already processed values.

log_pr_curve("pr_value", precision, recall, step=10)
  • Args:
    • name: str, name of the curve
    • y_preds: List[float] or numpy.array
    • y_targets: List[float] or numpy.array
    • step: int, optional
    • timestamp: datetime, optional

log_sklearn_pr_curve

log_sklearn_pr_curve(self, name, y_preds, y_targets, step=None, timestamp=None, is_multi_class=False)

Calculates and logs PR curve using sklearn.

log_sklearn_pr_curve("pr_value", y_preds, y_targets, step=10)

If you are logging a multi-class roc curve, you should set is_multi_class=True to allow persisting curves for all classes.

  • Args:
    • name: str, name of the event
    • y_preds: List[float] or numpy.array
    • y_targets: List[float] or numpy.array
    • step: int, optional
    • timestamp: datetime, optional
    • is_multi_class: bool, optional

log_curve

log_curve(self, name, x, y, annotation=None, step=None, timestamp=None)

Logs a custom curve.

log_curve("pr_value", x, y, annotation="more=info", step=10)
  • Args:
    • name: str, name of the curve
    • x: List[float] or numpy.array
    • y: List[float] or numpy.array
    • annotation: str, optional
    • step: int, optional
    • timestamp: datetime, optional

log_confusion_matrix

log_confusion_matrix(self, name, x, y, z, step=None, timestamp=None)

Logs a custom curve.

z = [[0.1, 0.3, 0.5, 0.2],
     [1.0, 0.8, 0.6, 0.1],
     [0.1, 0.3, 0.6, 0.9],
     [0.6, 0.4, 0.2, 0.2]]

x = ['healthy', 'multiple diseases', 'rust', 'scab']
y = ['healthy', 'multiple diseases', 'rust', 'scab']
log_confusion_matrix("confusion_test", x, y, z, step=11)
  • Args:
    • name: str, name of the curve
    • x: List[float] or List[str] or numpy.array
    • x: List[float] or List[str] or numpy.array
    • z: List[List[float]] or List[List[str]] or numpy.array
    • step: int, optional
    • timestamp: datetime, optional

log_plotly_chart

log_plotly_chart(self, name, figure, step=None, timestamp=None)

Logs a plotly chart/figure.

  • Args:
    • name: str, name of the figure
    • figure: plotly.figure
    • step: int, optional
    • timestamp: datetime, optional

log_bokeh_chart

log_bokeh_chart(self, name, figure, step=None, timestamp=None)

Logs a bokeh chart/figure.

  • Args:
    • name: str, name of the figure
    • figure: bokeh.figure
    • step: int, optional
    • timestamp: datetime, optional

log_altair_chart

log_altair_chart(self, name, figure, step=None, timestamp=None)

Logs a vega/altair chart/figure.

  • Args:
    • name: str, name of the figure
    • figure: figure
    • step: int, optional
    • timestamp: datetime, optional

log_mpl_plotly_chart

log_mpl_plotly_chart(self, name, figure, step=None, timestamp=None, close=True, fallback_to_image=True)

Logs a matplotlib figure to plotly figure.

  • Args:
    • name: str, name of the figure
    • figure: figure
    • step: int, optional
    • timestamp: datetime, optional
    • close: bool, optional, default True
    • fallback_to_image: bool, optional, default True

set_description

set_description(self, description, async_req=True)

Sets a new description for the current run.

  • Args:
    • description: str, the description to set.
    • async_req: bool, optional, default: False, execute request asynchronously.

set_name

set_name(self, name, async_req=True)

Sets a new name for the current run.

  • Args:
    • name: str, the name to set.
    • async_req: bool, optional, default: False, execute request asynchronously.

log_status

log_status(self, status, reason=None, message=None, last_transition_time=None, last_update_time=None)

Logs a new run status.

- __Note__: If you are executing a managed run, you don't need to call this method manually. This method is only useful for manual runs outside of Polyaxon.

N.B you will probably use one of the simpler methods:

  • log_succeeded
  • log_stopped
  • log_failed
  • start
  • end

Run API

  • Args:
    • status: str, a valid Statuses value.
    • reason: str, optional, reason or service issuing the status change.
    • message: str, optional, message to log with this status.
    • last_transition_time: datetime, default now.
    • last_update_time: datetime, default now.

log_inputs

log_inputs(self, reset=False, async_req=True)

Logs or resets new inputs/params for the current run.

Note: If you are starting a run from the CLI/UI polyaxon will track all inputs from the Polyaxonfile, so you generally don’t need to set them manually. But you can always add or reset these params/inputs once your code starts running.

  • Args:
    • reset: bool, optional, if True, it will reset the whole inputs state. Note that Polyaxon will automatically populate the inputs based on the Polyaxonfile inputs definition and params passed.
    • async_req: bool, optional, default: False, execute request asynchronously.
    • inputs: **kwargs, e.g. param1=value1, param2=value2, …

log_outputs

log_outputs(self, reset=False, async_req=True)

Logs a new outputs/results for the current run.

  • Args:
    • reset: bool, optional, if True, it will reset the whole outputs state. Note that Polyaxon will automatically populate some outputs based on the Polyaxonfile outputs definition and params passed.
    • async_req: bool, optional, default: False, execute request asynchronously.
    • outputs: **kwargs, e.g. output1=value1, metric2=value2, …

log_tags

log_tags(self, tags, reset=False, async_req=True)

Logs new tags for the current run.

  • Args:
    • tags: str or List[str], tag or tags to log.
    • reset: bool, optional, if True, it will reset the whole tags state. Note that Polyaxon will automatically populate the tags based on the Polyaxonfile.
    • async_req: bool, optional, default: False, execute request asynchronously.

log_meta

log_meta(self, reset=False, async_req=True)

Logs meta_info for the current run.

Note: Use carefully! The meta information is used by Polyaxon internally to perform several information.

Polyaxon Client already uses this method to log information about several events and artifacts, Polyaxon API/Scheduler uses this information to set meta information about the run.

An example use case for this method is to update the concurrency of a pipeline to increase/decrease the initial value:

from polyaxon.client import RunClient
client = RunClient()
client.log_meta(concurrency=5)
  • Args:
    • reset: bool, optional, if True, it will reset the whole meta info state.
    • async_req: bool, optional, default: False, execute request asynchronously.
    • meta: **kwargs, e.g. concurrency=10, has_flag=True, …

log_progress

log_progress(self, value)

Logs the progress of the run.

In offline

  • Args:
    • value: float, a value between 0 and 1 representing the percentage of run’s progress.

log_succeeded

log_succeeded(self, reason=None, message='Operation has succeeded')

Sets the current run to succeeded status.

- __Note__: If you are executing a managed run, you don't need to call this method manually. This method is only useful for manual runs outside of Polyaxon.

log_stopped

log_stopped(self, reason=None, message='Operation is stopped')

Sets the current run to stopped status.

- __Note__: If you are executing a managed run, you don't need to call this method manually. This method is only useful for manual runs outside of Polyaxon.

log_failed

log_failed(self, reason=None, message=None)

Sets the current run to failed status.

- __Note__: If you are executing a managed run, you don't need to call this method manually. This method is only useful for manual runs outside of Polyaxon.
  • Args:
    • reason: str, optional, reason or service issuing the status change.
    • message: str, optional, message to log with this status.

end

end(self)

Manually end a run and trigger post done logic (artifacts and lineage collection).


log_code_ref

log_code_ref(self, code_ref=None, is_input=True)

Logs code reference as a lineage information with the code_ref dictionary in the summary field.

  • Args:
    • code_ref: dict, optional, if not provided, Polyaxon will detect the code reference from the git repo in the current path.
    • is_input: bool, if the code reference is an input or outputs.

log_artifact_ref

log_artifact_ref(self, path, kind, name=None, hash=None, content=None, summary=None, is_input=False, rel_path=None, skip_hash_calculation=False)

Logs an artifact reference with custom kind.

Logging a generic file reference to the lineage table:

# Get outputs artifact path
asset_path = tracking.get_outputs_path("test.txt")
with open(asset_path, "w") as f:
    f.write("Artifact content.")
# Log reference to the lineage table
# Name of the artifact will default to test
tracking.log_artifact_ref(path=asset_path, kind=V1ArtifactKind.FILE)
  • Note: This is a generic method that is used by log_file_ref and log_model_ref.

  • Args:

    • path: str, filepath, the name is extracted from the filepath
    • kind: V1ArtifactKind, the artifact kind
    • name: str, if the name is passed it will be used instead of the filename from the path.
    • hash: str, optional, default = None, the hash version of the file, if not provided it will be calculated based on the file content
    • content: the file content
    • summary: Dict, optional, additional summary information to log about data in the lineage table
    • is_input: bool, if the file reference is an input or outputs
    • rel_path: str, optional relative path to the run artifacts path
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation

log_model_ref

log_model_ref(self, path, name=None, framework=None, summary=None, is_input=False, rel_path=None, skip_hash_calculation=False)

Logs model reference.

Note: The difference between this method and the log_model is that this one does not copy or move the asset, it only registers a lineage reference. If you need the model asset to be on the artifacts_path or the outputs_path you have to copy it manually using a relative path to self.get_artifacts_path or self.get_outputs_path.

# Get outputs artifact path
asset_path = tracking.get_outputs_path("model/model_data.h5")
with open(asset_path, "w") as f:
   f.write("Artifact content.")
# Log reference to the lineage table
# Name of the artifact will default to model_data
tracking.log_model_ref(path=asset_path)
  • Args:
    • path: str, filepath, the name is extracted from the filepath.
    • name: str, if the name is passed it will be used instead of the filename from the path.
    • framework: str, optional, name of the framework.
    • summary: Dict, optional, additional summary information to log about data in the lineage table.
    • is_input: bool, if the file reference is an input or outputs.
    • rel_path: str, optional relative path to the run artifacts path.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation.

log_data_ref

log_data_ref(self, name, hash=None, path=None, content=None, summary=None, is_input=True, skip_hash_calculation=False)

Logs data reference.

  • Args:
    • name: str, name of the data.
    • hash: str, optional, default = None, the hash version of the data, if not provided it will be calculated based on the data in the content.
    • path: str, optional, path of where the data is coming from.
    • summary: Dict, optional, additional summary information to log about data in the lineage table.
    • is_input: bool, optional, if the data reference is an input or outputs.
    • content: optional, if the data content is passed, polyaxon will calculate the hash.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation.

log_file_ref

log_file_ref(self, path, name=None, hash=None, content=None, summary=None, is_input=False, rel_path=None, skip_hash_calculation=False)

Logs file reference.

  • Args:
    • path: str, filepath, the name is extracted from the filepath.
    • name: str, if the name is passed it will be used instead of the filename from the path.
    • hash: str, optional, default = None, the hash version of the file, if not provided it will be calculated based on the file content.
    • content: the file content.
    • summary: Dict, optional, additional summary information to log about data in the lineage table.
    • is_input: bool, if the file reference is an input or outputs.
    • rel_path: str, optional relative path to the run artifacts path.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation.

log_dir_ref

log_dir_ref(self, path, name=None, hash=None, summary=None, is_input=False, rel_path=None, skip_hash_calculation=False)

Logs dir reference.

  • Args:
    • path: str, dir path, the name is extracted from the path.
    • name: str, if the name is passed it will be used instead of the dirname from the path.
    • hash: str, optional, default = None, the hash version of the file, if not provided it will be calculated based on the file content.
    • summary: Dict, optional, additional summary information to log about data in the lineage table.
    • is_input: bool, if the dir reference is an input or outputs.
    • rel_path: str, optional relative path to the run artifacts path.
    • skip_hash_calculation: optional, flag to instruct the client to skip hash calculation.

log_artifact_lineage

log_artifact_lineage(self, body, async_req=True)

Logs an artifact lineage.

Note: This method can be used to log manual lineage objects, it is used internally to log model/file/artifact/code refs

  • Args:
    • body: dict or List[dict] or V1RunArtifact or List[V1RunArtifact], body of the lineage.
    • async_req: bool, optional, default: False, execute request asynchronously.

log_env

log_env(self, rel_path=None, content=None)

Logs information about the environment.

Called automatically if track_env is set to True.

Can be called manually, and can accept a custom content as a form of a dictionary.

  • Args:
    • rel_path: str, optional, default “env.json”.
    • content: Dict, optional, default to current system information.

set_artifacts_path

set_artifacts_path(self, artifacts_path=None, is_related=False)

Sets the root artifacts_path.

Note: Both in-cluster and offline modes will call this method automatically. Be careful, this method is called automatically. Polyaxon has some processes to automatically sync your run’s artifacts and outputs.

  • Args:
    • artifacts_path: str, optional
    • is_related: bool, optional, To create multiple runs in-cluster in a notebook or a vscode session.

set_run_event_logger

set_run_event_logger(self)

Sets an event logger.

Note: Both in-cluster and offline modes will call this method automatically. Be careful, this method is called automatically. Polyaxon has some processes to automatically sync your run’s artifacts and outputs.


set_run_resource_logger

set_run_resource_logger(self)

Sets an resources logger.

Note: Both in-cluster and offline modes will call this method automatically. Be careful, this method is called automatically. Polyaxon has some processes to automatically sync your run’s artifacts and outputs.


sync_events_summaries

sync_events_summaries(self, last_check, events_path)

Syncs all tracked events and auto-generates summaries and lineage data.

Note: Both in-cluster and offline modes will manage syncing events summaries automatically, so you should not call this method manually.