ads.opctl package#

Subpackages#

Submodules#

ads.opctl.cli module#

ads.opctl.cli.add_options(options)[source]#

ads.opctl.cmds module#

class ads.opctl.cmds.DataScienceResource[source]#

Bases: str

DATAFLOW = 'dataflowapplication'#
JOB = 'datasciencejob'#
MODEL = 'datasciencemodel'#
MODEL_DEPLOYMENT = 'datasciencemodeldeployment'#
PIPELINE = 'datasciencepipeline'#
class ads.opctl.cmds.DataScienceResourceRun[source]#

Bases: str

DATAFLOW_RUN = 'dataflowrun'#
JOB_RUN = 'datasciencejobrun'#
MODEL_DEPLOYMENT = 'datasciencemodeldeployment'#
PIPELINE_RUN = 'datasciencepipelinerun'#
ads.opctl.cmds.activate(**kwargs) None[source]#

Activate a ModelDeployment.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.cmds.cancel(**kwargs) None[source]#

Cancel a MLJob/DataFlow run.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.cmds.configure() None[source]#

Save default configurations for opctl.

Parameters:

ml_job (bool) – turn on/off saving configurations for ML Job

Return type:

None

ads.opctl.cmds.deactivate(**kwargs) None[source]#

Deactivate a ModelDeployment.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.cmds.delete(**kwargs) None[source]#

Delete a MLJob/DataFlow run.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.cmds.init(resource_type: str, runtime_type: str | None = None, output: str | None = None, overwrite: bool = False, ads_config: str = '~/.ads_ops', **kwargs) str | None[source]#

Generates a starter specification template YAML for the Data Science resource.

Parameters:
  • resource_type (str) – The resource type to generate the specification YAML.

  • runtime_type ((str, optional). Defaults to None.) – The resource runtime type.

  • output ((str, optional). Defaults to None.) – The path to the file to save the resulting specification template YAML.

  • overwrite ((bool, optional). Defaults to False.) – Whether to overwrite the result specification YAML if exists.

  • ads_config ((str, optional)) – The folder where the ads opctl config located.

  • kwargs ((Dict, optional).) – Any optional kwargs arguments.

Returns:

The YAML specification for the given resource if output was not provided, path to the specification otherwise.

Return type:

Union[str, None]

Raises:

ValueError – If resource_type not specified.

ads.opctl.cmds.init_vscode(**kwargs) None[source]#

Create a .devcontainer.json file for local development.

Parameters:

kwargs – keyword arguments, stores command line args

Return type:

None

ads.opctl.cmds.predict(**kwargs) None[source]#

Make prediction using the model with the payload.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.cmds.run(config: Dict, **kwargs) Dict[source]#

Run a job given configuration and command line args passed in (kwargs).

Parameters:
  • config (dict) – dictionary of configurations

  • kwargs (dict) – keyword arguments, stores configuration from command line args

Returns:

dictionary of job id and run id in case of ML Job run, else empty if running locally

Return type:

Dict

ads.opctl.cmds.run_diagnostics(config: Dict, **kwargs) Dict[source]#

Run a job given configuration and command line args passed in (kwargs).

Parameters:
  • config (dict) – dictionary of configurations

  • kwargs (dict) – keyword arguments, stores configuration from command line args

Returns:

dictionary of job id and run id in case of ML Job run, else empty if running locally

Return type:

Dict

ads.opctl.cmds.watch(**kwargs) None[source]#

Watch a MLJob/DataFlow run.

Parameters:

kwargs (dict) – keyword argument, stores command line args

Return type:

None

ads.opctl.constants module#

class ads.opctl.constants.BACKEND_NAME(value)[source]#

Bases: ExtendedEnum

An enumeration.

DATAFLOW = 'dataflow'#
JOB = 'job'#
LOCAL = 'local'#
MARKETPLACE = 'marketplace'#
MODEL_DEPLOYMENT = 'deployment'#
OPERATOR_LOCAL = 'operator.local'#
PIPELINE = 'pipeline'#
class ads.opctl.constants.RESOURCE_TYPE(value)[source]#

Bases: ExtendedEnum

An enumeration.

DATAFLOW = 'dataflow'#
JOB = 'job'#
MARKETPLACE = 'marketplace'#
MODEL_DEPLOYMENT = 'deployment'#
OPERATOR = 'operator'#
PIPELINE = 'pipeline'#
class ads.opctl.constants.RUNTIME_TYPE(value)[source]#

Bases: ExtendedEnum

An enumeration.

CONDA = 'conda'#
CONTAINER = 'container'#
DATAFLOW = 'dataFlow'#
DATAFLOWNOTEBOOK = 'dataFlowNotebook'#
GITPYTHON = 'gitPython'#
NOTEBOOK = 'notebook'#
OPERATOR = 'operator'#
PYTHON = 'python'#
SCRIPT = 'script'#

ads.opctl.utils module#

ads.opctl.utils.build_image(image_type: str, gpu: bool = False) None[source]#

Build an image for opctl.

Parameters:
  • image_type (str) – specify the image to build, can take ‘job-local’, former for running job with conda pack locally, latter for running operators

  • gpu (bool) – whether to use gpu version of image

  • dst_image (str) – image to save as when building custom operator

Return type:

None

ads.opctl.utils.get_docker_client() docker.client.DockerClient[source]#
ads.opctl.utils.get_namespace(auth: dict) str[source]#
ads.opctl.utils.get_oci_region(auth: dict) str[source]#
ads.opctl.utils.get_region_key(auth: dict) str[source]#
ads.opctl.utils.get_service_pack_prefix() Dict[source]#
ads.opctl.utils.is_in_notebook_session()[source]#
ads.opctl.utils.list_ads_operators() dict[source]#
ads.opctl.utils.parse_conda_uri(uri: str) Tuple[str, str, str, str][source]#
ads.opctl.utils.publish_image(image: str, registry: str | None = None) None[source]#

Publish an image.

Parameters:
  • image (str) – image name

  • registry (str) – registry to push to

Return type:

None

ads.opctl.utils.run_command(cmd: str | List[str], cwd: str | None = None, shell: bool = False) Popen[source]#
ads.opctl.utils.run_container(image: str, bind_volumes: Dict, env_vars: Dict, command: str = None, entrypoint: str = None, verbose: bool = False) int[source]#
ads.opctl.utils.suppress_traceback(debug: bool = True) None[source]#

Decorator to suppress traceback when in debug mode.

Parameters:

debug (bool) – turn on debug mode or not

Return type:

None

Module contents#

ads.opctl.set_log_level(level)[source]#