

# How to submit a job to Deadline Cloud
Submit a job

There are many different ways to submit jobs to AWS Deadline Cloud. This section describes some of the ways that you can submit jobs using the tools provided by Deadline Cloud or by creating your own custom tools for your workloads. 
+ From a terminal – for when you’re first developing a job bundle, or when users submitting a job are comfortable using the command line
+ From a script – for customizing and automating workloads
+ From an application – for when the user’s work is in an application, or when an application’s context is important.

 The following examples use the `deadline` Python library and the `deadline` command line tool. Both are available from [PyPi](https://pypi.org/project/deadline/) and [hosted on GitHub](https://github.com/aws-deadline/deadline-cloud). 

**Topics**
+ [

# Submit a job to Deadline Cloud from a terminal
](from-a-terminal.md)
+ [

# Submit a job to Deadline Cloud using a script
](from-a-script.md)
+ [

# Submit a job within an application
](from-within-applications.md)

# Submit a job to Deadline Cloud from a terminal
From a terminal

Using only a job bundle and the Deadline Cloud CLI, you or your more technical users can rapidly iterate on writing job bundles to test submitting a job. Use the following command to submit a job bundle: 

```
deadline bundle submit <path-to-job-bundle>
```

 If you submit a job bundle with parameters that do not have defaults in the bundle, you can specify them with the `-p` / `--parameter` option. 

```
deadline bundle submit <path-to-job-bundle> -p <parameter-name>=<parameter-value> -p ...
```

 For a complete list of the available options, run the help command: 

```
deadline bundle submit --help
```

## Submit a job to Deadline Cloud using a GUI


 The Deadline Cloud CLI also comes with a graphical user interface that enables users to see the parameters they must provide before submitting a job. If your users prefer not to interact with the command line, you can write a desktop shortcut that opens a dialog to submit a specific job bundle: 

```
deadline bundle gui-submit <path-to-job-bundle>
```

 Use the `--browse` option can so the user can select a job bundle: 

```
deadline bundle gui-submit --browse
```

 For a complete list of available options, run the help command: 

```
deadline bundle gui-submit --help
```

# Submit a job to Deadline Cloud using a script
From a script

 To automate submitting jobs to Deadline Cloud, you can script them using tools such as bash, Powershell, and batch files. 

You can add functionality like populating job parameters from environment variables or other applications. You can also submit multiple jobs in a row, or script the creation of a job bundle to submit. 

## Submit a job using Python


Deadline Cloud also has an open-source Python library to interact with the service. The [source code is available on GitHub](https://github.com/aws-deadline/deadline-cloud). 

The library is available on pypi via pip (`pip install deadline`). It's the same library used by the Deadline Cloud CLI tool: 

```
from deadline.client import api

job_bundle_path = "/path/to/job/bundle"
job_parameters = [
    {
        "name": "parameter_name",
        "value": "parameter_value"
    },
]

job_id = api.create_job_from_job_bundle(
    job_bundle_path,
    job_parameters
)
print(job_id)
```

 To create a dialog like the `deadline bundle gui-submit` command, you can use of `show_job_bundle_submitter` function from the [`deadline.client.ui.job_bundle_submitter`.](https://github.com/aws-deadline/deadline-cloud/blob/mainline/src/deadline/client/ui/job_bundle_submitter.py) 

 The following example starts a Qt application and shows the job bundle submitter: 

```
# The GUI components must be installed with pip install "deadline[gui]"
import sys
from qtpy.QtWidgets import QApplication
from deadline.client.ui.job_bundle_submitter import show_job_bundle_submitter

app = QApplication(sys.argv)
submitter = show_job_bundle_submitter(browse=True)
submitter.show()
app.exec()
print(submitter.create_job_response)
```

To make your own dialog you can use the `SubmitJobToDeadlineDialog` class in [https://github.com/aws-deadline/deadline-cloud/blob/mainline/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py](https://github.com/aws-deadline/deadline-cloud/blob/mainline/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py). You can pass in values, embed your own job specific tab, and determine how the job bundle gets created (or passed in). 

# Submit a job within an application
From within applications

 To make it easy for users to submit jobs, you can use the scripting runtimes or plugin systems provided by an application. Users have a familiar interface and you can create powerful tools that assist the users when submitting a workload. 

## Embed job bundles in an application


This example demonstrates submitting job bundles that you make available in the application.

 To give a user access to these job bundles, create a script embedded in a menu item that launches the Deadline Cloud CLI. 

 The following script enables a user to select the job bundle: 

```
deadline bundle gui-submit --install-gui
```

 To use a specific job bundle in a menu item instead, use the following: 

```
deadline bundle gui-submit </path/to/job/bundle> --install-gui
```

 This opens a dialog where the user can modify the job parameters, inputs, and outputs, and then submit the job. You can have different menu items for different job bundles for a user to submit in an application. 

If the job that you submit with a job bundle contains similar parameters and asset references across submissions, you can fill in the default values in the underlying job bundle. 

## Get information from an application


To pull information from an application so that users don't have to manually add it to the submission, you can integrate Deadline Cloud with the application so that your users can submit jobs using a familiar interface without needing exit the application or use command line tools.

If your application has a scripting runtime that supports Python and pyside/pyqt, you can use the GUI components from the [Deadline Cloud client library](https://github.com/aws-deadline/deadline-cloud) to create a UI. For an example, see [Deadline Cloud for Maya integration](https://github.com/aws-deadline/deadline-cloud-for-maya) on GitHub. 

The Deadline Cloud client library provides operations that do the following to help you provide a strong integrated user experience:
+ Pull queue environment parameters, job parameters, and asset references form environment variables and by calling the application SDK.
+ Set the parameters in the job bundle. To avoid modifying the original bundle, you should make a copy of the bundle and submit the copy.

If you use the `deadline bundle gui-submit` command to submit the job bundle, you must programmatically the `parameter_values.yaml` and `asset_references.yaml` files to pass the information from the application. For more information about these files see [Open Job Description (OpenJD) templates for Deadline Cloud](build-job-bundle.md).

If you need more complex controls than the ones offered by OpenJD, need to abstract the job from the user, or want to make the integration match the application's visual style, you can write your own dialog that calls the Deadline Cloud client library to submit the job.