Files
Eric Allam 620b83832b Implement manually invokable jobs through the invokeTrigger (#700)
* Implement manually invokable jobs through the invokeTrigger

Also implemented a job run notification system, that will POST details of a run on completion. This combines with the task callbackUrl system to implement the invokeAndWait

* Document the invoke trigger

* batch invoke and wait

* background fetch timeouts

* Use @whatwg-node/fetch instead of the polyfilled fetch

* Fix some outdated dependencies in webapp

* Improved subtask error propogation messages

* Document the OpenAI changes and the batch invoke stuff

* Fix dequeuing jobs

* Don’t retry the OpenAI completion background task

* Added OpenAI changesets

* Use the new ResumeTaskService in ProcessCallbackTimeout as well
2023-11-03 11:05:00 +00:00

133 lines
4.0 KiB
Plaintext

---
title: "Context"
sidebarTitle: "context"
description: "The third parameter in a Job's `run()` function. An object that contains information about the Organization, Job, Run and more."
---
`context` has useful information about the:
- Job
- Environment
- Organization
- Run
- event
- source
- account
## Properties
<ResponseField name="job" type="object" required>
Metadata about the Job
<Expandable title="properties">
<ResponseField name="id" type="string" required>
The Job's ID
</ResponseField>
<ResponseField name="version" type="string" required>
The Job's version
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="environment" type="object" required>
Metadata about the Environment
<Expandable title="properties">
<ResponseField name="slug" type="string" required>
The Environment's slug
</ResponseField>
<ResponseField name="id" type="string" required>
The Environment's ID
</ResponseField>
<ResponseField name="type" type="string" required>
The Environment's type. One of: "PRODUCTION", "STAGING", "DEVELOPMENT", "PREVIEW".
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="organization" type="object" required>
Metadata about the Organization
<Expandable title="properties">
<ResponseField name="slug" type="string" required>
The Organization's slug
</ResponseField>
<ResponseField name="id" type="string" required>
The Organization's ID
</ResponseField>
<ResponseField name="title" type="string" required>
The Organization's title
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="run" type="object" required>
Metadata about the Run
<Expandable title="properties">
<ResponseField name="id" type="string" required>
The Run's ID
</ResponseField>
<ResponseField name="isTest" type="boolean" required>
Whether the Run is a test run
</ResponseField>
<ResponseField name="startedAt" type="Date" required>
When the Run started
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="project" type="object" required>
Metadata about the Project
<Expandable title="properties">
<ResponseField name="slug" type="string" required>
The Project's slug
</ResponseField>
<ResponseField name="id" type="string" required>
The Project's ID
</ResponseField>
<ResponseField name="name" type="string" required>
The Project's title
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="event" type="object" required>
Metadata about the Event that triggered the Run.
<Expandable title="properties">
<ResponseField name="id" type="string" required>
The Event's ID
</ResponseField>
<ResponseField name="name" type="string" required>
The Event's name
</ResponseField>
<ResponseField name="context" type="any" required>
The Event's context. This is additional data that been passed through
</ResponseField>
<ResponseField name="timestamp" type="Date" required>
When the Event was triggered
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="source" type="object">
Metadata about the Source that triggered the Run.
<Expandable title="properties">
<ResponseField name="id" type="string" required>
The Source's ID
</ResponseField>
<ResponseField name="metadata" type="any">
The Source's metadata. This is additional data that been passed through
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="account" type="object">
Metadata about the Account that triggered the Run. See the [BYO Auth
docs](/documentation/guides/using-integrations-byo-auth) for more information.
<Expandable title="properties">
<ResponseField name="id" type="string" required>
The Account's ID
</ResponseField>
<ResponseField name="metadata" type="any">
The Account's metadata. This is additional data that been passed through
</ResponseField>
</Expandable>
</ResponseField>