Skip to content

Commit 3ec4abe

Browse files
committed
Removed running job status
1 parent a1bb055 commit 3ec4abe

File tree

10 files changed

+38
-40
lines changed

10 files changed

+38
-40
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Unreleased
44

5+
* Removed `running` job status (\#401).
56
* Aligned timestamp definitions with fractal-server 1.4.3 (\#401).
67
* Sorted projects by descending creation timestamp (\#401).
78
* Removed coverage setup from Playwright tests and CI (\#399).

__tests__/JobsList.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('JobsList', () => {
4040
const filters = result.getAllByRole('combobox');
4141

4242
const statusFilter = filters[0];
43-
verifyOptions(statusFilter, ['', 'running', 'done', 'failed', 'submitted']);
43+
verifyOptions(statusFilter, ['', 'submitted', 'done', 'failed']);
4444
const projectFilter = filters[1];
4545
verifyOptions(projectFilter, ['', '1', '2']);
4646
const workflowFilter = filters[2];
@@ -80,7 +80,7 @@ describe('JobsList', () => {
8080
await clearFilters(result);
8181

8282
// Filter by job status
83-
await fireEvent.change(statusFilter, { target: { value: 'running' } });
83+
await fireEvent.change(statusFilter, { target: { value: 'submitted' } });
8484
table = result.getByRole('table');
8585
expect(table.querySelectorAll('tbody tr').length).eq(1);
8686
expect(table.querySelectorAll('tbody tr td')[6].textContent).eq('input3');
@@ -162,14 +162,14 @@ describe('JobsList', () => {
162162
vi.useFakeTimers();
163163
try {
164164
const jobUpdater = function () {
165-
return data.jobs.map((j) => (j.status === 'running' ? { ...j, status: 'done' } : j));
165+
return data.jobs.map((j) => (j.status === 'submitted' ? { ...j, status: 'done' } : j));
166166
};
167167
const result = render(JobsList, {
168168
props: { jobUpdater }
169169
});
170170
let table = result.getByRole('table');
171171
expect(table.querySelectorAll('tbody tr').length).eq(3);
172-
expect(table.querySelectorAll('tbody tr:nth-child(1) td')[0].textContent).contain('running');
172+
expect(table.querySelectorAll('tbody tr:nth-child(1) td')[0].textContent).contain('submitted');
173173
expect(table.querySelectorAll('tbody tr:nth-child(2) td')[0].textContent).contain('failed');
174174
expect(table.querySelectorAll('tbody tr:nth-child(3) td')[0].textContent).contain('done');
175175

__tests__/mock/jobs-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const data = {
7171
input_dataset_dump: { id: 5, name: 'input3' },
7272
output_dataset_dump: { id: 6, name: 'output3' },
7373
end_timestamp: null,
74-
status: 'running',
74+
status: 'submitted',
7575
user_email: '[email protected]'
7676
}
7777
]

src/lib/components/jobs/JobStatusIcon.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
{#if status}
77
<span title={status}>
88
{#if status === 'submitted'}
9-
<i class="bi bi-hourglass text-secondary job-status-submitted" />
10-
{:else if status === 'running'}
11-
<div class="spinner-border spinner-border-sm text-primary job-status-icon-running" role="status">
9+
<div class="spinner-border spinner-border-sm text-primary job-status-icon-submitted" role="status">
1210
<span class="visually-hidden">Loading...</span>
1311
</div>
1412
{:else if status === 'done'}
@@ -33,7 +31,7 @@
3331
border-radius: 50%;
3432
}
3533
36-
:global(.active .job-status-icon-running, .active .job-status-submitted) {
34+
:global(.active .job-status-submitted) {
3735
color: #fff !important;
3836
}
3937
</style>

src/lib/components/jobs/JobsList.svelte

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
errorAlert.hide();
9393
}
9494
95-
console.log('Stop running job');
95+
console.log('Stop submitted job');
9696
9797
cancellingJobs = [...cancellingJobs, job.id];
9898
jobCancelledMessage = '';
@@ -133,7 +133,7 @@
133133
let updateJobsTimeout = undefined;
134134
135135
async function updateJobsInBackground() {
136-
const jobsToCheck = jobs.filter((j) => j.status === 'running' || j.status === 'submitted');
136+
const jobsToCheck = jobs.filter((j) => j.status === 'submitted');
137137
if (jobsToCheck.length > 0) {
138138
jobs = await jobUpdater();
139139
tableHandler.setRows(jobs);
@@ -227,10 +227,9 @@
227227
<th>
228228
<select class="form-control" bind:value={statusFilter}>
229229
<option value="">All</option>
230-
<option value="running">Running</option>
230+
<option value="submitted">Submitted</option>
231231
<option value="done">Done</option>
232232
<option value="failed">Failed</option>
233-
<option value="submitted">Submitted</option>
234233
</select>
235234
</th>
236235
<th />
@@ -324,7 +323,7 @@
324323
</a>
325324
{/if}
326325
{/if}
327-
{#if row.status === 'running'}
326+
{#if row.status === 'submitted'}
328327
<button
329328
class="btn btn-danger"
330329
on:click={() => handleJobCancel(row)}

src/lib/components/jobs/StatusBadge.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
switch (status) {
1111
case 'submitted':
1212
return 'badge text-bg-info';
13-
case 'running':
14-
return 'badge text-bg-primary';
1513
case 'done':
1614
return 'badge text-bg-success';
1715
case 'failed':

src/lib/components/projects/CreateUpdateDatasetModal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@
380380
}),
381381
project_id: originalDataset.project_id,
382382
project: originalDataset.project,
383-
history: []
383+
history: [],
384+
timestamp_created: originalDataset.timestamp_created
384385
};
385386
}
386387

src/lib/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export type Dataset = {
6767
timestamp_created: string
6868
}
6969

70-
export type JobStatus = 'submitted' | 'running' | 'done' | 'failed'
70+
export type JobStatus = 'submitted' | 'done' | 'failed'
7171

7272
export type ApplyWorkflow = {
7373
id: number

src/routes/admin/jobs/+page.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
async function jobUpdater() {
3939
/** @type {import('$lib/types').ApplyWorkflow[]} */
40-
const jobsToCheck = jobs.filter((j) => j.status === 'running' || j.status === 'submitted');
40+
const jobsToCheck = jobs.filter((j) => j.status === 'submitted');
4141
/** @type {import('$lib/types').ApplyWorkflow[]} */
4242
const updatedJobs = [];
4343
for (const job of jobsToCheck) {
@@ -281,10 +281,9 @@
281281
<div class="col-9">
282282
<select class="form-control" bind:value={status} id="status">
283283
<option value="">All</option>
284-
<option value="running">Running</option>
284+
<option value="submitted">Submitted</option>
285285
<option value="done">Done</option>
286286
<option value="failed">Failed</option>
287-
<option value="submitted">Submitted</option>
288287
</select>
289288
</div>
290289
</div>
@@ -426,7 +425,7 @@
426425
</button>
427426
</svelte:fragment>
428427
<svelte:fragment slot="edit-status" let:row>
429-
{#if row.status === 'submitted' || row.status === 'running'}
428+
{#if row.status === 'submitted'}
430429
&nbsp;
431430
<button class="btn btn-link p-0" on:click={() => openEditStatusModal(row)}>
432431
<i class="bi bi-pencil" />

src/routes/projects/[projectId]/workflows/experimental/[workflowId]/+page.svelte

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
let newVersionsMap = {};
8080
8181
/** @type {import('$lib/types').ApplyWorkflow|undefined} */
82-
let selectedRunningJob;
82+
let selectedSubmittedJob;
8383
8484
$: updatableWorkflowList = workflow.task_list || [];
8585
@@ -422,7 +422,7 @@
422422
// eslint-disable-next-line
423423
runWorkflowModal.toggle();
424424
const job = await response.json();
425-
selectedRunningJob = job;
425+
selectedSubmittedJob = job;
426426
await loadJobsStatus();
427427
} else {
428428
console.error(response);
@@ -509,7 +509,7 @@
509509
if (selectedInputDatasetId === undefined || selectedOutputDatasetId === undefined) {
510510
return;
511511
}
512-
selectedRunningJob = await getSelectedRunningJob(
512+
selectedSubmittedJob = await getSelectedSubmittedJob(
513513
selectedInputDatasetId,
514514
selectedOutputDatasetId
515515
);
@@ -526,14 +526,12 @@
526526
return;
527527
}
528528
statuses = outputStatus.status;
529-
const runningOrSubmitted = Object.values(statuses).filter(
530-
(s) => s === 'running' || s === 'submitted'
531-
);
532-
if (runningOrSubmitted.length > 0) {
529+
const submitted = Object.values(statuses).filter((s) => s === 'submitted');
530+
if (submitted.length > 0) {
533531
clearTimeout(statusWatcherTimer);
534532
statusWatcherTimer = setTimeout(loadJobsStatus, updateJobsInterval);
535533
} else {
536-
selectedRunningJob = undefined;
534+
selectedSubmittedJob = undefined;
537535
}
538536
}
539537
@@ -542,13 +540,13 @@
542540
* @param {number} outputDatasetId
543541
* @return {Promise<import('$lib/types').ApplyWorkflow|undefined>}
544542
*/
545-
async function getSelectedRunningJob(inputDatasetId, outputDatasetId) {
543+
async function getSelectedSubmittedJob(inputDatasetId, outputDatasetId) {
546544
if (
547-
selectedRunningJob &&
548-
selectedRunningJob.input_dataset_id === inputDatasetId &&
549-
selectedRunningJob.output_dataset_id === outputDatasetId
545+
selectedSubmittedJob &&
546+
selectedSubmittedJob.input_dataset_id === inputDatasetId &&
547+
selectedSubmittedJob.output_dataset_id === outputDatasetId
550548
) {
551-
return selectedRunningJob;
549+
return selectedSubmittedJob;
552550
}
553551
const response = await fetch(`/api/v1/project/${project.id}/workflow/${workflow.id}/job`, {
554552
method: 'GET',
@@ -571,14 +569,14 @@
571569
}
572570
573571
async function stopWorkflow() {
574-
if (!selectedRunningJob) {
572+
if (!selectedSubmittedJob) {
575573
return;
576574
}
577575
if (workflowErrorAlert) {
578576
workflowErrorAlert.hide();
579577
}
580578
const response = await fetch(
581-
`/api/v1/project/${project.id}/job/${selectedRunningJob.id}/stop`,
579+
`/api/v1/project/${project.id}/job/${selectedSubmittedJob.id}/stop`,
582580
{
583581
method: 'GET',
584582
credentials: 'include'
@@ -655,7 +653,7 @@
655653
</div>
656654
</div>
657655
<div class="col-lg-4 col-md-12">
658-
{#if selectedRunningJob && (selectedRunningJob.status === 'running' || selectedRunningJob.status === 'submitted')}
656+
{#if selectedSubmittedJob && selectedSubmittedJob.status === 'submitted'}
659657
<button class="btn btn-danger" on:click={stopWorkflow}>
660658
<i class="bi-stop-circle-fill" /> Stop workflow
661659
</button>
@@ -752,7 +750,7 @@
752750
{/if}
753751
</button>
754752
{/each}
755-
</div>
753+
</div>
756754
{/if}
757755
</div>
758756
</div>
@@ -1155,7 +1153,11 @@
11551153
checkingConfiguration = false;
11561154
}}>Cancel</button
11571155
>
1158-
<button class="btn btn-primary" on:click|preventDefault={handleApplyWorkflow} disabled={applyingWorkflow}>
1156+
<button
1157+
class="btn btn-primary"
1158+
on:click|preventDefault={handleApplyWorkflow}
1159+
disabled={applyingWorkflow}
1160+
>
11591161
{#if applyingWorkflow}
11601162
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" />
11611163
{/if}

0 commit comments

Comments
 (0)