Skip to content
Snippets Groups Projects
Commit f952d077 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Valentin Rigal
Browse files

Entypescripten the job API helpers

parent d454d9b9
No related branches found
No related tags found
1 merge request!1510Entypescripten the job API helpers
import axios from 'axios'
import { unique } from '.'
import { Job, UUID } from '@/types'
// List background jobs
export const listJobs = unique(async () => (await axios.get('/jobs/')).data)
export const listJobs = unique(async (): Promise<Job[]> => (await axios.get('/jobs/')).data)
// Cancel a pending job or delete a finished/failed job
export const deleteJob = unique(id => axios.delete(`/jobs/${id}/`))
export const deleteJob = unique((id: UUID) => axios.delete(`/jobs/${id}/`))
......@@ -348,4 +348,22 @@ export interface Dataset {
name: string
description: string
sets: string[]
}
\ No newline at end of file
}
export type JobStatus = 'queued' | 'started' | 'deferred' | 'finished' | 'stopped' | 'scheduled' | 'canceled' | 'failed'
/**
* An asynchronous job performed by RQ
*/
export interface Job {
id: UUID
description: string
/**
* Current progress of the job, between 0 and 1. May not be available for every job.
*/
progress: number | null
status: JobStatus
enqueued_at: string | null
started_at: string | null
ended_at: string | null
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment