Skip to content

Run a Job

In AskAnna you can trigger jobs using the web interface, CLI, Python SDK or API. In the section Running the job you can find examples as well.

On the job page you can find information about how you can run a job in AskAnna. When new options become available, we will extend the option presented here.

Web interface

The fastest and easiest way of triggering a job is via the web interface. On the tab PLATFORM you can add a payload and run the job. The payload is optional, so you can leave it empty. When you run the job, you will also see the status of the run and a button to open the run.

Run a job via the web interface

AskAnna CLI

First, install the AskAnna CLI to be able to start running a job via the command line:

askanna run

If you are running the command from a project directory with an askanna.yml and the push-target set to a valid project, then the CLI will ask you which job you want to run. If this information is not available, the CLI will check if you are a member of multiple workspaces or projects. If that's the case, a wizard guide you to select a job to run.

To make live easier, you can also specify the name of the job:

askanna run "JOB NAME"

Or the SUUID of the job:

askanna run --id JOB_SUUID

If you want to push your code, and then run the job you can combine these tasks in one command:

askanna run "JOB NAME" --push

Similar to the API, you can add JSON data as a string:

askanna run "JOB NAME" --data '{"example": "payload"}'

Or a JSON file:

askanna run "JOB NAME" --data-file 'input/payload.json'

For more options check the help:

askanna run -h

API

You can trigger jobs using our API. You can find all the information you need on the job page in the section Running the job. For the API you will find a Shell example. In the example you see:

  • The URL including the job SUUID
  • Your authorization token
  • An example data payload

When you copy this code, you only need to change the data (second row) and you are ready to run it via your terminal. In case you are going to work often with APIs, we advise using a software platform like Postman.

The JSON data is optional. You can also run jobs without this content. If you add a JSON data body to the API request, it will become available as the payload (input) for the job run. This way you can add data, variables, or both to your job run.

Python

AskAnna SDK

First, install the Python AskAnna SDK. Then you can run a job in your Python script:

from askanna import run

run_info = run.start(job_suuid="JOB SUUID")

If you run the code from a project directory with an askanna.yml and the push-target set to a avlid project, you can also use the name of the job:

from askanna import run

run_info = run.start(job_name="JOB NAME")

It's also possible to include a dictionary with JSON data as input for the run:

from askanna import run

json_data = {"example": "payload"}
run_info = run.start(job_name="JOB NAME", data=json_data)

Request

In the tab PYTHON you can find an example of how you can use the AskAnna API to run a job in Python. When you trigger a job via Python, you can use the response for follow-up actions. For example to monitor when the jobs are finished so you can retrieve a result.

Run a job via Python

Run environment

The default run environment is Python 3.7 with 1 CPU. Besides Python 3.7 we also installed:

  • Git
  • Unzip
  • Curl
  • g++
  • AskAnna CLI & SDK

If you want to have another run environment, you can always contact us ([email protected]).