# Running automations

# Configuring Agent Servers

# An overview of the steps you'll need to take to deploy and run a new automation in Prefix.

In order for any automations to run, you must have Agent Servers connected to the Orchestrator. These are machines designated to actually execute automations. The ability to connect many such machines to your Orchestrator make Prefix incredibly scalable for running larger workloads.

Currently, configuring new Agent Servers is somewhat of an involved process, so if you'd like to set one up, or there are issues with your deployment, please contact us directly through Slack or email support@prefix.app.

# Inputs & Outputs

Prefix helps teams organize data flow into and out of their automations using objects of various types. Here's a summary of what this looks like:

# Job Inputs:

Job Data | Tables | Files | Vault

# Job Outputs:

Logs
Not a formal data type within Prefix, but are artifacts generated whenever a job runs nonetheless.

Tables | Files

All the above data types are separated by Workspaces in Prefix

# Starting jobs

# There are four ways you can kickoff automations in our Orchestrator, each is covered below.

# Manually

Jobs can be triggered manually from Prefix Orchestrator. This is useful for testing if a newly created model runs as expected, or for running infrequent jobs.

To do so, use the Action '...' button from the Jobs page for the corresponding Job, or click the name of the job to visit the Job Details page, then click Instant Job Run. You may need to click the refresh button on the top right of this page to get status updates on this run.

# Using a Trigger Table

Jobs can be triggered when data from Data Tables in Prefix change. Because jobs in Prefix can output Data Tables, this means you can chain jobs to run after each other as data is updated and available.

To start a job when a Data Table is updated, fill the Trigger Table field when creating a new job.

# Using a Schedule

Prefix has a powerful scheduler for Jobs that need to run routinely (nightly, weekly, monthly, on calendar days, you name it). Visit the Scheduler page, select your Tenant, Workspace, Model, and Job from the dropdowns at the top, and hit Create to start working on a custom schedule for a particular automation.

# Starting jobs (API)

We offer a basic service API for starting Jobs in Prefix and passing Job Data (also referred to as "Variables", in the Studio) to them in the request.

# Authentication

# Request
Service Method
AUTH POST http://cloud.prefix.app/api/auth/login
# Parameters
Location Name Required Type Example
JSON BODY email Yes string sa-agent@agent.service
JSON BODY password Yes string secret-agent
# Response
HTTP CODE Payload
200 OK {
access_token: <your_access_token>,
refresh_token: <your_refresh_token>,
type: "Bearer",
roles: [ <your_roles> ]
}

# Run Job

This endpoint allows you to start the job with job_id in Prefix. You can find this ID by clicking View Schedule Settings in the Job Details page for a particular automation.

Prefix secures its API with token based authentication. While we are working to enable the use of a developer key, for now you must run the Authentication request above, and pass the accessToken attribute of the response as a Bearer token in the HTTP header when using this endpoint.

In the following, auth_response is the JSON response from running the above request.

# Request
Service URL
SCHEDULER POST http://cloud.prefix.app/api/scheduler/run/<job_id>
# Headers
Name Required Type Example
Authorization Yes string Bearer <auth_response.accessToken>
# Parameters
Location Name Required Type Example
JSON BODY inputData No string String representation of JSON Job Data (use stringify/json.dumps)
# Response
HTTP CODE Payload
200 OK