Remote Jobs

Runner Jobs

Manage runner jobs and runner-side job execution.

Request a new job

POST
https://peertube2.cpy.re/api/v1/runners/jobs/request

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired
jobTypesArray<string>

Filter jobs depending on their types

Response

200OKobject

successful operation

Response fields application/json
availableJobsArray<object>
Show child attributes
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
typeRunnerJobTypevod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcoding
payloadobject
Show child attributes
Any of
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
audioFileUrlstring
previewFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber

Accept job

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/accept

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

200OKobject

successful operation

Response fields application/json
jobRunnerJob & object
Show child attributes
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
typeRunnerJobTypevod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcoding
Show child attributes
idRunnerJobState12345678

The runner job state:

  • 1 Pending
  • 2 Processing
  • 3 Completed
  • 4 Errored
  • 5 Waiting for a parent job
  • 6 Cancelled
  • 7 Parent had an error
  • 8 Parent has been cancelled
labelstring
Example
Processing
payloadobject
Show child attributes
Any of
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
audioFileUrlstring
previewFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
failuresinteger

Number of times a remote runner failed to process this job. After too many failures, the job in "error" state

errorstring | null

Error message if the job is errored

progressinteger

Percentage progress

priorityinteger

Job priority (less has more priority)

updatedAtstring<date-time>
createdAtstring<date-time>
startedAtstring<date-time>
finishedAtstring<date-time>
parentobject | null

If job has a parent job

Show child attributes
typeRunnerJobTypevod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcoding
Show child attributes
idRunnerJobState12345678

The runner job state:

  • 1 Pending
  • 2 Processing
  • 3 Completed
  • 4 Errored
  • 5 Waiting for a parent job
  • 6 Cancelled
  • 7 Parent had an error
  • 8 Parent has been cancelled
labelstring
Example
Processing
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
runnerany | null

If job is associated to a runner

Show child attributes
idnumber
namestring
descriptionstring
jobTokenstring

Abort job

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/abort

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired
reasonstringrequired

Why the runner aborts this job

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Update job

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/update

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired
progressinteger

Update job progression percentage (optional)

payloadobject
Show child attributes
Any of

Provide live transcoding chunks update

typestringadd-chunkremove-chunk
masterPlaylistFilestring<binary>
resolutionPlaylistFilestring<binary>
resolutionPlaylistFilenamestring
videoChunkFilestring<binary>
videoChunkFilenamestring

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Post job error

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/error

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired
messagestringrequired

Why the runner failed to process this job

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Post job success

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/success

API used by PeerTube runners

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired
payloadobjectrequired
Show child attributes
Any of
videoFilestring<binary>
videoFilestring<binary>
resolutionPlaylistFilestring<binary>
videoFilestring<binary>
object

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Download the max-quality audio file for a job video

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/max-quality/audio

API used by PeerTube runners.

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath
videoIdOrUUIDid | UUIDv4 | shortUUIDrequiredpath

Video id or UUID

Response

200OKstring<binary>

successful operation

Response fields application/octet-stream
string<binary>
403Forbidden

the job is not associated with this video

Download the max-quality video file for a job video

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/max-quality

API used by PeerTube runners.

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath
videoIdOrUUIDid | UUIDv4 | shortUUIDrequiredpath

Video id or UUID

Response

200OKstring<binary>

successful operation

Response fields application/octet-stream
string<binary>
403Forbidden

the job is not associated with this video

Download the max-quality thumbnail for a job video

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/thumbnails/max-quality

API used by PeerTube runners.

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath
videoIdOrUUIDid | UUIDv4 | shortUUIDrequiredpath

Video id or UUID

Response

200OKstring<binary>

successful operation

Response fields application/octet-stream
string<binary>
403Forbidden

the job is not associated with this video

Download the max-quality preview for a job video

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/previews/max-quality

API used by PeerTube runners.

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath
videoIdOrUUIDid | UUIDv4 | shortUUIDrequiredpath

Video id or UUID

Response

200OKstring<binary>

successful operation

Response fields application/octet-stream
string<binary>
403Forbidden

the job is not associated with this video

Download a video studio task file for a job video

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/files/videos/{videoIdOrUUID}/studio/task-files/{filename}

API used by PeerTube runners.

Body

application/json
runnerTokenstringrequired
jobTokenstringrequired

Parameters

jobUUIDUUIDv4<uuid>requiredpath
videoIdOrUUIDid | UUIDv4 | shortUUIDrequiredpath

Video id or UUID

filenamestringrequiredpath

Name of the task file to download

Response

200OKstring<binary>

successful operation

Response fields application/octet-stream
string<binary>
400Bad Request

the file is not associated with this edition task

403Forbidden

the job is not associated with this video

Cancel a job

POST
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}/cancel

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Authorization

OAuth2oauth2

Authenticating via OAuth requires the following steps:

  • Have an activated account
  • Generate an access token for that account at /api/v1/users/token.
  • Make requests with the Authorization: Bearer <token> header
  • Profit, depending on the role assigned to the account

Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.

Scopes: admin

Delete a job

DELETE
https://peertube2.cpy.re/api/v1/runners/jobs/{jobUUID}

The endpoint will first cancel the job if needed, and then remove it from the database. Children jobs will also be removed

Parameters

jobUUIDUUIDv4<uuid>requiredpath

Response

204No Content

successful operation

Authorization

OAuth2oauth2

Authenticating via OAuth requires the following steps:

  • Have an activated account
  • Generate an access token for that account at /api/v1/users/token.
  • Make requests with the Authorization: Bearer <token> header
  • Profit, depending on the role assigned to the account

Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.

Scopes: admin

List jobs

GET
https://peertube2.cpy.re/api/v1/runners/jobs

Parameters

startinteger>= 0query

Offset used to paginate results

countinteger[1, 100]15query

Number of items to return

sortstringupdatedAtcreatedAtprioritystateprogressquery

Sort runner jobs by criteria

searchstringquery

Plain text search, applied to various parts of the model depending on endpoint

stateOneOfArray<RunnerJobState>12345678query
typeOneOfArray<RunnerJobType>vod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcodingquery

Response

200OKobject

successful operation

Response fields application/json
totalinteger
Example
1
Show child attributes
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
typeRunnerJobTypevod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcoding
Show child attributes
idRunnerJobState12345678

The runner job state:

  • 1 Pending
  • 2 Processing
  • 3 Completed
  • 4 Errored
  • 5 Waiting for a parent job
  • 6 Cancelled
  • 7 Parent had an error
  • 8 Parent has been cancelled
labelstring
Example
Processing
payloadobject
Show child attributes
Any of
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
videoFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
inputobject
Show child attributes
audioFileUrlstring
previewFileUrlstring
outputobject
Show child attributes
resolutionnumber
fpsnumber
failuresinteger

Number of times a remote runner failed to process this job. After too many failures, the job in "error" state

errorstring | null

Error message if the job is errored

progressinteger

Percentage progress

priorityinteger

Job priority (less has more priority)

updatedAtstring<date-time>
createdAtstring<date-time>
startedAtstring<date-time>
finishedAtstring<date-time>
parentobject | null

If job has a parent job

Show child attributes
typeRunnerJobTypevod-web-video-transcodingvod-hls-transcodingvod-audio-merge-transcodinglive-rtmp-hls-transcoding
Show child attributes
idRunnerJobState12345678

The runner job state:

  • 1 Pending
  • 2 Processing
  • 3 Completed
  • 4 Errored
  • 5 Waiting for a parent job
  • 6 Cancelled
  • 7 Parent had an error
  • 8 Parent has been cancelled
labelstring
Example
Processing
Example
9c9de5e8-0a1e-484a-b099-e80766180a6d
runnerany | null

If job is associated to a runner

Show child attributes
idnumber
namestring
descriptionstring
privatePayloadobject

Authorization

OAuth2oauth2

Authenticating via OAuth requires the following steps:

  • Have an activated account
  • Generate an access token for that account at /api/v1/users/token.
  • Make requests with the Authorization: Bearer <token> header
  • Profit, depending on the role assigned to the account

Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.

Scopes: admin