:orphan:

======================
Scheduling deployments
======================

If you want to :doc:`deploy a project <../deployments/index>` on a regular
basis, Data Science & AI Workbench enables you to schedule the deployment. For example,
you can schedule a deployment that's resource intensive to run after regular
business hours, or to import new data on a weekly basis.

.. note::
   A task that's run via a scheduled deployment can read data previously
   committed to the project from an editor session, but cannot be used to
   commit any new data to it. **Any data written to a container for a scheduled
   deployment will be deleted immediately after the associated task runs**, so
   Anaconda recommends that you ensure data is read from and written to
   :doc:`external data sources <../data/load>`.

**To schedule a deployment:**

#. Open the project you want to schedule a deployment for by clicking on it in
   the **Projects** list.

#. Click **Schedules** in the menu on the left.

#. Click **New** if it's the first schedule to be created for the project, or
   the Schedule |icon| button if there are existing schedules.

   .. thumbnail:: ../../images/create-schedule.png
      :align: center

#. Give the schedule a meaningful name to help differentiate it from any other
   schedules.

#. Specify whether you want to deploy the latest version of the project, or
   select a particular version.

#. Specify the **Deployment Command** to use to deploy the project. If there is
   no deployment command listed, you cannot deploy the project. 

   Return to the project and add a deployment command, or ask the project owner
   to do so if it's not your project. See :doc:`Configuring project settings<../projects/project-config>` for more information about adding deployment commands.

#. Choose the runtime resources your project requires to run from the
   **Resource Profile** drop-down, or accept the default. Your Administrator
   configures the options in this list, so check with them if you aren't sure. 

#. Use the controls to specify how often and when you want to schedule the
   deployment, or select **Custom** and enter a valid ``cron`` expression.

.. note::
   All scheduled times are in UTC (Coordinated Universal Time).

   Alternatively, if you want it to run *now*---instead of scheduling it---select **Run Now**.

#. Click **Schedule** to create the schedule, and display it's details. You can
   use the available controls to pause, refresh, edit, or delete the schedule.

   .. thumbnail:: ../../images/schedule-details.png
      :align: center

#. To view the new schedule in the list of schedules for the project,
    click **Schedules** in the menu on the left. 

Use the controls above the **Schedules** list to pause or delete a selected
schedule, or click on a schedule in the list to view and edit its details.

.. note::
   Schedules that have already run can be deleted only, as there is nothing
   to pause.

.. thumbnail:: ../../images/scheduled-run.png
   :align: center

To view a list of all the scheduled deployments that are currently running or
have already run, click **Runs** in the menu on the left.

.. thumbnail:: ../../images/schedule-runs.png
   :align: center

Select a specific run in the list to enable the controls to refresh, stop or
delete it.

.. thumbnail:: ../../images/schedule-runs2.png
   :align: center

.. |icon| image:: ../../images/icons/project-create-upload.png
          :width: 25 px
