Creating jobs for code files (Watson Studio)

Notebook and script files in a project with default Git integration are not added as assets to the project's Assets page. You can however select those files to run as jobs from the View local branch tab on the project's Assets page.

To create a code-based job:

  1. From the project's Assets page, select View local branch and click New code job.

  2. Select the notebook file or script to run and click Configure job.

  3. Define the job details by entering a name and a description (optional).

  4. On the Configure page, select:

    • A runtime. By default, the job uses the same environment template that was selected for the notebook.

    • Advanced configuration to add environment variables or Python script arguments.

      • Add environment variables that are passed when the job is started and affect the execution of the notebook or script.

        Each variable declaration must be made for a single variable in the following format and appear on its own line:

        VAR_NAME1=foo1
        VAR_NAME2=foo2
        

        For example, to determine which data source to access if the same notebook is used in different jobs, you can set the variable DATA_SOURCE to DATA_SOURCE=jdbc:db2//db2.server.com:1521/testdata in the notebook job that trains a model and to DATA_SOURCE=jdbc:db2//db2.server.com:1521/productiondata in the job where the model runs on real data. In another example, the variables BATCH_SIZE, NUM_CLASSES and EPOCHS that are required for a Keras model can be passed to the same notebook with different values in separate jobs.

      • Python scripts only: Add arguments to use the same Python script in a variety of ways or for different use cases.

        Each script argument must be entered in the following format and appear on its own line:

        arg1
        arg2
        arg3
        

        For example, you can define arguments to read the contents of different input tables and then run the script to generate the corresponding HTML reports, sometimes for test purposes and other times in production runs.

    • Job run retention settings to set how long to retain finished job runs and job run artifacts like logs. You can either select the number of days to retain the job runs or the last number of job runs to keep. The retention value is set to 5 by default (the last 5 job run output files are retained).

      Be mindful when changing the default as too many job run files can quickly use up project storage.

  5. Optionally set to see notifications for the job. You can select the type of alerts to receive.

  6. Review the job settings. Then create the job and run it immediately, or create the job and run it later.

    The job is listed under Jobs in your project.

Learn more

Parent topic: Jobs