V1Plugins

polyaxon.polyflow.plugins.V1Plugins(auth=None, docker=None, shm=None, mount_artifacts_store=None, collect_artifacts=None, collect_logs=None, collect_resources=None, sync_statuses=None, auto_resume=None, log_level=None, external_host=None, sidecar=None, notifications=None)

Plugins section provides a way to customize extra Polyaxon utilities.

By default, Polyaxon injects some information for example an auth context and triggers some mechanisms for collecting logs and outputs.

Plugins section provides more control to the end user to enable/disable some of these utilities.

  • Args:
    • auth: bool, optional, default: True
    • docker: bool, optional, default: False
    • shm: bool, optional, default: True
    • mount_artifacts_store: bool, optional, default: True
    • collect_artifacts: bool, optional, default: True
    • collect_logs: bool, optional, default: True
    • collect_resources: bool, optional, default: True
    • auto_resume: bool, optional, default: True
    • log_level: str, optional
    • sidecar: V1PolyaxonSidecarContainer, optional

YAML usage

plugins:
  auth:
  docker:
  shm:
  mountArtifactsStore:
  collectArtifacts:
  collectLogs:
  collectResources:
  autoResume:
  externalHost:
  logLevel:
  sidecar:

Python usage

from polyaxon.polyflow import V1Plugins
plugins = V1Plugins(
    auth=False,
    docker=True,
    shm=True.
    mount_artifacts_store=True,
    collect_artifacts=False,
    collect_logs=False,
    collect_resources=False
    auto_resume=False,
    external_host=False,
    log_level="INFO",
)

Fields

auth

This plugin is enabled by default in Polyaxon deployments with user management.

By default, Polyaxon will create an auth context for each operation, this removes the overhead to think about how you can pass tokens to your runs, or the need to create secrets to load the token from during the run time.

The auth context that Polyaxon provides is not only specific to the user who executed the run, but it also impersonates similar user access rights, it has the same scopes and restrictions the user usually has within the context of the project managing the run. This is important to make sure the API calls made during the run by the user’s code have the right access to the resources requested.

Oftentimes, users might not need to use an authenticated client inside their containers, in that case they can disable this plugin.

To disable this plugin:

plugins:
  auth: false

docker

This plugin is disabled by default.

This plugin exposes a docker socket volume to your run container.

N.B. use this plugin carefully, you might also need to check with your devops team before using it, it requires docker.sock of the host to be mounted which is often rejected by OPA.

To enable this plugin:

plugins:
  docker: true

shm

This plugin is enabled by default.

This plugin mounts an tmpfs volume to /dev/shm. This will set /dev/shm size to half of the RAM of node. By default, /dev/shm is very small, only 64MB. Some experiments/jobs will fail due to the lack of shared memory, such as some experiments running on Pytorch.

To disable this plugin:

plugins:
  shm: false

mountArtifactsStore

This plugin is disabled by default.

this plugin allows to request the default artifacts store and mount it to the main container without adding the connection reference name to the connections section.

This is usually very useful than setting the connections section as it make the component more generic and will not break if the artifacts store name changes.

collectArtifacts

This plugin is enabled by default.

By default, Polyaxon will collect all artifacts and outputs that you share in the plx-context/artifacts/run-uuid/outputs to the default artifacts store that you configured during the deployment.

This plugin is important if you want to have an agnostic code to the type of storage backend your are using, by changing the environment variable you can test your code with tmp file locally and the artifacts path in production.

To disable this plugin:

plugins:
  collectArtifacts: false

Sometimes you might want to access the artifacts path in your polyaxonfile, Polyaxon expose a context that get resolved during the compilation time, you can just use “{{run_artifacts_path}}” global variable and it will be resolved automatically.

  • Example:
run:
  kind: job
  container:
    command: "cp /some/know/path/file {{run_artifacts_path}}/file"

For more information about the context, please check context

collectLogs

This plugin is enabled by default.

By default, Polyaxon will collect all logs related to your runs before deleting the resource on the clusters. This ensures that your cluster(s) are kept clean and no resources are actively putting pressure on the API server.

Sometimes you might want to avoid collecting logs for some runs, for example test or debug jobs.

To disable this plugin:

plugins:
  collectLogs: false

collectResources

This plugin is enabled by default.

By default, Polyaxon will collect all Mem/CPU/GPU resources for your runs that use the python client.

Sometimes you might want to avoid collecting this information for some runs, for example test or debug jobs.

To disable this plugin:

plugins:
  collectResources: false

autoResume

This plugin is enabled by default.

By default, Polyaxon will resume from collecting metrics/outputs/artifacts if a run fails and retries or if the user resume a run.

To disable this plugin:

plugins:
  autoResume: false

externalHost

Default is False.
In some edge cases where the auxiliaries and/or the main container cannot reach the API/Streams services via the internal networking interface, you can enable this flag to tell Polyaxon resolve the external host instead of the default behavior with the in-cluster host.
plugins:
  externalHost: true

logLevel

Default is None.

If you want to control the log level of your runs in a similar way locally and on the cluster, you can either use env vars or this plugin to share the same log level with all containers running in your operation.

plugins:
  logLevel: warning

sidecar

Default is None.

To override the default global sidecar configuration.

plugins:
  sidecar:
    syncInterval: 60