ads.jobs.templates package¶
Submodules¶
ads.jobs.templates.container module¶
ads.jobs.templates.driver_notebook module¶
This module runs a Jupyter Python notebook with nbconvert and print the outputs. This is a driver script auto-generated by Oracle ADS.
The following environment variables are used: JOB_RUN_NOTEBOOK:
The relative path of the jupyter Python notebook to be executed.
- NOTEBOOK_EXCLUDE_TAGS:
Optional, a list of tags serialized to JSON string. Notebook cells with one of the tags will be excluded from running.
- NOTEBOOK_ENCODING:
Optional, the encoding for opening the notebook.
- OUTPUT_URI:
Optional, object storage URI for saving files from the output directory.
- class ads.jobs.templates.driver_notebook.ADSExecutePreprocessor(**kwargs: Any)[source]¶
Bases:
ExecutePreprocessor
Customized Execute Preprocessor for running notebook.
Initialize the preprocessor
- Parameters:
exclude_tags (list, optional) – A list of cell tags, notebook cells with any of these cell tag will be skipped. Defaults to None.
- ads.jobs.templates.driver_notebook.run_notebook(notebook_path: str, working_dir: str | None = None, exclude_tags: list | None = None) CellExecutionError | None [source]¶
Runs a notebook
- Parameters:
- Returns:
Exception object when there is an error in a notebook cell. Otherwise, None.
- Return type:
CellExecutionError or None
ads.jobs.templates.driver_oci module¶
This is a driver script from Oracle ADS to run Python script in OCI Data Science Jobs. The following environment variables are used: GIT_URL:
URL to the Git repository.
- GIT_BRANCH:
Optional, the Git branch to checkout.
- GIT_COMMIT:
Optional, the Git commit to checkout. By default, the most recent git commit will be checked out.
- CODE_DIR:
Optional, the directory for saving the user code from Git repository. Defaults to “~/Code”
- GIT_ENTRYPOINT:
Relative path to the entry script/module file in the Git repository.
- ENTRY_FUNCTION:
Optional, function name in the entry script/module to be invoked. If this is not specified, the entry script will be run as Python script.
- PYTHON_PATH:
Optional, additional paths to be added to sys.path for looking up modules and packages. The root of the Git repository will be added by default. Multiple paths can be separated by os.pathsep, which is colon(:) for Linux and Mac, semicolon(;) for Windows.
- OUTPUT_DIR:
Optional, output directory to be copied to object storage.
- OUTPUT_URI:
Optional, object storage URI for saving files from the output directory.
- GIT_SECRET_OCID:
The OCID of the OCI vault secret storing the SSH key for Git commands.
- SKIP_METADATA_UPDATE:
If this variable exists, the update metadata step will be skipped.
- OCI_IAM_TYPE:
Authentication method for OCI services. OCI API key will be used if this is set to api_key. Otherwise resource principal will be used.
- OCI_CONFIG_LOCATION:
The location of OCI API key when OCI_IAM_TYPE is set to api_key. If this is not set, oci.config.DEFAULT_LOCATION will be used.
- OCI_CONFIG_PROFILE:
The profile name to be used for API key authentication. If this is not set, oci.config.DEFAULT_PROFILE will be used.
- OCI__GIT_SSH_KEY_PATH:
The location to save the SSH Key for accessing the git repository.
- JOB_RUN_OCID:
The OCID of the job run. This is set by the job run.
This module requires the following packages: oci requests GitPython git openssh
- class ads.jobs.templates.driver_oci.GitJobRunner(git_manager: GitManager, job_run_ocid: str | None = None)[source]¶
Bases:
JobRunner
Contains methods for running the job.
Initialize the job runner
- Parameters:
job_run_ocid (str, optional) – Job run OCID, by default “”.
purpose (For local testing)
string (job run OCID can be set to empty)
- class ads.jobs.templates.driver_oci.GitManager(repo_url: str, code_dir: str | None = None)[source]¶
Bases:
object
Contains methods for fetching code from Git repository
Initialize the GitManager
- Parameters:
- Raises:
ValueError – URL is not specified.
ads.jobs.templates.driver_python module¶
This is a driver script auto-generated by Oracle ADS to run Python script in OCI Data Science Jobs.
The following environment variables are used: CODE_ENTRYPOINT:
Relative path to the entry script/module file in the user code directory.
- ENTRY_FUNCTION:
Optional, function name in the entry script/module to be invoked. If this is not specified, the entry script will be run as Python script.
- PYTHON_PATH:
Optional, additional paths to be added to sys.path for looking up modules and packages. The root of the user code will be added by default. Multiple paths can be separated by os.pathsep, which is colon(:) for Linux and Mac, semicolon(;) for Windows.
- OUTPUT_DIR:
Optional, output directory to be copied to object storage.
- OUTPUT_URI:
Optional, object storage URI for saving files from the output directory.
- WORKING_DIR:
Optional, the working directory of the user code. This can be specified as a relative path from /home/datascience/decompressed_artifact/code If this is not specified, the working directory will be /home/datascience/decompressed_artifact/code
This module requires the following package: oci