Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | import { Signal } from '@lumino/signaling'; import { Scheduler } from './handler'; export class NotebookJobsListingModel implements INotebookJobsListingModel { private _scheduled_jobs: Scheduler.IDescribeJob[]; readonly scheduledJobsChanged: Signal<any, any>; readonly inProgressJobCountChanged: Signal<any, number>; public inProgressJobCount: number; constructor(scheduled_jobs: Scheduler.IDescribeJob[], next_token?: string) { const inProgressJobs = scheduled_jobs ? scheduled_jobs.filter(job => job.status === 'IN_PROGRESS') : []; this.inProgressJobCount = inProgressJobs.length; this._scheduled_jobs = scheduled_jobs; this.scheduledJobsChanged = new Signal(this); this.inProgressJobCountChanged = new Signal(this); } updateJobs(jobs: Scheduler.IDescribeJob[]) { let jobsChanged = false; Iif (jobs.length != this._scheduled_jobs.length) { jobsChanged = true; } Iif (!jobsChanged) { for (let i = 0; i < jobs.length; i++) { const job = jobs[i]; const modelJob = this._scheduled_jobs[i]; Iif (job.status !== modelJob.status) { jobsChanged = true; break; } } } Iif (jobsChanged) { this._scheduled_jobs = jobs; this.scheduledJobsChanged.emit(jobs); } } updateJobsCount(jobCount: number) { Iif (jobCount !== this.inProgressJobCount) { this.inProgressJobCount = jobCount; this.inProgressJobCountChanged.emit(jobCount); } } } export interface INotebookJobsWithToken { jobs: Scheduler.IDescribeJob[]; next_token?: string; } export interface INotebookJobsListingModel { inProgressJobCount: number; inProgressJobCountChanged: Signal<any, number>; scheduledJobsChanged: Signal<any, INotebookJobsWithToken>; } export interface ICreateJobInputModel { jobName: string; inputFile: string; outputPath: string; environment: string; parameters?: { [key: string]: any }; } export interface ICreateJobInput { changed: Signal<ICreateJobInputModel, string>; model: ICreateJobInputModel; } |