Use these APIs to handle job and task related queries.
Run job using launch single engine template
Most of the cognitive engines available in aiWARE come with a simplified single engine job template that runs a single engine on content specified by passing either a URL or a TDO.
Using a URL
Example
mutation launchSingleEngineJob{
launchSingleEngineJob(
input: {
uploadUrl:"https://vtn-dev-test-files.s3.amazonaws.com/media/video/sv/SlowSwedish.mp4"
engineId:"c0e55cde-340b-44d7-bb42-2e0d65e98255"
}
) {
id
targetId
status
}
}
Using a TDO
Example
mutation launchSingleEngineJob{
launchSingleEngineJob(
input: {
targetId: "2621266289"
engineId:"c0e55cde-340b-44d7-bb42-2e0d65e98255"
}
) {
id
targetId
status
}
}
Run job on existing URL using createJob
The createJob mutation lets you define your own job definitions from scratch. You can create chained cognition jobs that tie multiple engines together for a more complex job.
Example
mutation runTranscription {
createJob(input: {
target: {
name: "Transcription Test.mp4"
startDateTime: "2020-07-23T19:40:04.000Z"
stopDateTime: "2020-07-23T19:40:04.000Z"
}
tasks: [
{
engineId: "9e611ad7-2d3b-48f6-a51b-0a1ba40fe255" # Webstream Adapter (WSA) to bring in stream
payload: {
url: "https://images-assets.nasa.gov/video/NHQ_2020_0127_AskNASA%E2%94%83%20How%20Will%20Astronauts%20Dig%20on%20the%20Moon/NHQ_2020_0127_AskNASA%E2%94%83%20How%20Will%20Astronauts%20Dig%20on%20the%20Moon~orig.mp4"
}
ioFolders: [
{
referenceId: "wsaOutput"
mode: stream
type: output
}
]
},
{
engineId: "352556c7-de07-4d55-b33f-74b1cf237f25" # Stream Ingestor 2 (SI2) Playback, only include when media playback is needed in platform
ioFolders: [
{
referenceId: "playbackInput"
mode: stream
type: input
}
]
executionPreferences: {
parentCompleteBeforeStarting: true
}
},
{
engineId: "8bdb0e3b-ff28-4f6e-a3ba-887bd06e6440" # SI2 Chunk Creator, use to split media into chunks for processing
payload: {
ffmpegTemplate: "audio"
chunkOverlap: 3
customFFMPEGProperties: {
chunkSizeInSeconds: "180"
chunkOverlapDuration: "3s"
outputChunkDuration: "3m"
}
}
ioFolders: [
{
referenceId: "chunkAudioInput"
mode: stream
type: input
},
{
referenceId: "chunkAudioOutput"
mode: chunk
type: output
}
]
executionPreferences: {
parentCompleteBeforeStarting: true
}
},
{
engineId: "c0e55cde-340b-44d7-bb42-2e0d65e98255" # English Transcription engine
ioFolders: [
{
referenceId: "transcriptionInput"
mode: chunk
type: input
},
{
referenceId: "transcriptionOutput"
mode: chunk
type: output
}
]
executionPreferences: {
maxEngines: 10
parentCompleteBeforeStarting: true
}
},
{
engineId: "8eccf9cc-6b6d-4d7d-8cb3-7ebf4950c5f3" # Output Writer (OW), collates VTN-Standard output from cognitive engine
ioFolders: [
{
referenceId: "owInput"
mode: chunk
type: input
}
]
executionPreferences: {
parentCompleteBeforeStarting: true
priority: -10
}
}
]
routes: [
{
parentIoFolderReferenceId: "wsaOutput"
childIoFolderReferenceId: "playbackInput"
},
{
parentIoFolderReferenceId: "wsaOutput"
childIoFolderReferenceId: "chunkAudioInput"
},
{
parentIoFolderReferenceId: "chunkAudioOutput"
childIoFolderReferenceId: "transcriptionInput"
},
{
parentIoFolderReferenceId: "transcriptionOutput"
childIoFolderReferenceId: "owInput"
}
]
}) {
id
targetId
clusterId
tasks {
records{
id
engineId
payload
taskPayload
status
output
ioFolders {
referenceId
type
mode
}
}
}
routes {
parentIoFolderReferenceId
childIoFolderReferenceId
}
}
}
Run job on existing TDO
Runs a job on an existing Temporal Data Object (TDO).
[Note] For the TDO to appear correctly in Data Center, you need the last three engineId values.
Example
mutation runEngineJob {
createJob(
input: {
targetId: "102014611",
tasks: [
{
engineId: "8081cc99-c6c2-49b0-ab59-c5901a503508"
},
{
engineId: "insert-into-index"
},
{
engineId: "thumbnail-generator"
},
{
engineId: "mention-generate"
}
]
}
)
{
id
}
}
Run job on an external file and add results to an existing TDO
Use this mutation to process media that's not the primary resource on a TDO. Runs an engine job on an external file and then adds the results to an existing Temporal Data Object (TDO).
[Note] The URL must be public. Only change the second engineId value. The existing TDO must be empty with no assets.
Example
mutation runRTEngineJob {
createJob(input: {
targetId: "88900861",
tasks: [{
engineId: "9e611ad7-2d3b-48f6-a51b-0a1ba40feab4", # Webstream Adapter's Engine ID
payload: {
url: "https://s3.amazonaws.com/hold4fisher/s3Test.mp4"
}
},
{
engineId: "38afb67a-045b-43db-96db-9080073695ab" # Some engine ID you want to use for processing
}]
}) {
id
}
}
Run job with standby task
Runs a job with a standby task. A standby task is a task that runs if the first one fails.
Example
mutation createTranscriptionJobWithStandby {
createJob(input: {
targetId: "53796349",
tasks: [{
engineId: "transcribe-speechmatics-container-en-us",
standbyTask: {
engineId: "transcribe-speechmatics-container-en-us",
standbyTask: {
engineId: "transcribe-voicebase",
payload: { language: "en-US", priority: "low" }
}
}
}]
}) {
id
tasks {
records {
id
}
}
}
}
Get list of running jobs
Retrieves a list of currently running jobs. This example asks for a limit of 50 running jobs. The status can be pending, cancelled, queued, running, or complete.
Example
query runningJobs {
jobs(status: running, limit: 50) {
count
records {
id
targetId
createdDateTime
tasks {
records {
id
payload
}
}
}
}
}
Check job status of a specific job
Checks the job status of a specific job.
Example
query jobStatus {
job(id: "18114402_busvuCo21J") {
status
createdDateTime
targetId
tasks {
records {
status
createdDateTime
modifiedDateTime
id
engine {
id
name
category {
name
}
}
}
}
}
}
Response
{
"data": {
"job": {
"status": "complete",
"createdDateTime": "2019-02-26T21:15:59.000Z",
"targetId": "380612136",
"tasks": {
"records": [
{
"status": "complete",
"createdDateTime": "2019-02-26T21:15:59.000Z",
"modifiedDateTime": "2019-02-26T21:15:59.000Z",
"id": "19020926_wUALxLYqjoDh5N8",
"engine": {
"id": "915bb300-bfa8-4ce6-8498-50d43705a144",
"name": "mention-generate",
"category": {
"name": "Search"
}
}
},
{
"status": "complete",
"createdDateTime": "2019-02-26T21:15:59.000Z",
"modifiedDateTime": "2019-02-26T21:15:59.000Z",
"id": "19020926_wUALxLYqjolDUtw",
"engine": {
"id": "c2aaa6d7-14fa-f840-f77e-4d2c0b857fa8",
"name": "Add to Index",
"category": {
"name": "Search"
}
}
}
]
}
}
}
}
Get jobs by engine category
Retrieves jobs by engine category for all engines in given categories.
[Note] Use the dateTimeFilter field to filter responses by date as shown.
This example fetches a max limit of 3 transcription jobs, with a status of complete, created after 9/25/2021.
Example
query getTranscriptionJobs {
jobs(dateTimeFilter: {fromDateTime: "2021-09-25T03:10:40.000Z", field: createdDateTime}, limit: 3, status: complete, engineCategoryIds: ["67cd4dd0-2f75-445d-a6f0-2f297d6cd182"]) {
count
records {
id
targetId
createdDateTime
tasks {
records {
id
payload
}
}
}
}
}
Get information on most recent jobs
Retrieves information on the most recent jobs. This example shows information on the 10 most recent jobs.
Example
query {
jobs(orderBy: {field: createdDateTime, direction: desc}, limit: 10) {
records {
id
status
createdDateTime
target {
id
streams {
uri
protocol
}
assets {
records {
id
assetType
uri
details
}
}
}
tasks {
records {
id
status
engine {
id
name
}
queuedDateTime
completedDateTime
payload
}
}
}
}
}
Response
{
"data": {
"jobs": {
"records": [
{
"id": "19020926_0N2iBMnL1D",
"status": "complete",
"createdDateTime": "2019-02-26T21:15:59.000Z",
"target": {
"id": "380612133",
"streams": [],
"assets": {
"records": [
{
"id": "380612133_33TR5wyYyh",
"assetType": "media",
"uri": "https://inspirent.s3.amazonaws.com/assets/41020140/aca39ac2-181e-4837-a059-378acc6b24bd.mp4",
"details": null
}
]
}
},
"tasks": {
"records": [
{
"id": "19020926_0N2iBMnL1DuhMEl",
"status": "complete",
"engine": {
"id": "915bb300-bfa8-4ce6-8498-50d43705a144",
"name": "mention-generate"
},
"queuedDateTime": "2019-02-26T21:15:59.000Z",
"completedDateTime": "2019-02-26T21:15:59.000Z",
"payload": {
"organizationId": 17532
}
},
{
"id": "19020926_0N2iBMnL1D8bJUX",
"status": "complete",
"engine": {
"id": "c2aaa6d7-14fa-f840-f77e-4d2c0b857fa8",
"name": "Add to Index"
},
"queuedDateTime": "2019-02-26T21:15:59.000Z",
"completedDateTime": "2019-02-26T21:15:59.000Z",
"payload": {
"organizationId": 17532
}
}
]
}
},
...
Get information about a task
Retrieves information about a task.
Example
query {
task(id:"19020926_wUALxLYqjoDh5N8") {
id
status
name
engine {
id
name
displayName
}
engineId
}
}
Response
{
"data": {
"task": {
"id": "19020926_wUALxLYqjoDh5N8",
"status": "complete",
"name": null,
"engine": {
"id": "915bb300-bfa8-4ce6-8498-50d43705a144",
"name": "mention-generate",
"displayName": "mention-generate"
},
"engineId": "915bb300-bfa8-4ce6-8498-50d43705a144"
}
}
}
Get logs for tasks
Retrieves logs for tasks.
Example
query getLogs {
temporalDataObject(id: "331178425") {
tasks {
records {
engine {
id
name
}
id
status
startedDateTime
completedDateTime
log {
text
uri
}
}
}
}
}
Cancel job in progress
Cancels an in-progress job.
Example
mutation cancelJob {
cancelJob(id: "18114402_busvuCo21J") {
id
message
}
}
More API examples