List parallel jobs on node for jobs on shared node

- Relates to issue #97
- required GQL schema extension and regeneration
- Works for archived jobs aswell
This commit is contained in:
Christoph Kluge
2023-04-28 12:34:40 +02:00
parent e9301a5d39
commit d93610f700
8 changed files with 691 additions and 5 deletions

View File

@@ -95,7 +95,7 @@
{#if $initq.error}
<Card body color="danger">{$initq.error.message}</Card>
{:else if $initq.data}
<JobInfo job={$initq.data.job} jobTags={jobTags}/>
<JobInfo job={$initq.data.job} jobTags={jobTags} showParallelJobs={$initq.data.job.exclusive != 1}/>
{:else}
<Spinner secondary/>
{/if}

View File

@@ -12,9 +12,11 @@
<script>
import Tag from '../Tag.svelte';
import { Badge, Icon } from 'sveltestrap';
import { operationStore, query} from '@urql/svelte'
export let job;
export let jobTags = job.tags;
export let showParallelJobs = false
function formatDuration(duration) {
const hours = Math.floor(duration / 3600);
@@ -24,6 +26,27 @@
const seconds = duration;
return `${hours}:${('0' + minutes).slice(-2)}:${('0' + seconds).slice(-2)}`;
}
const filter = [
{exclusive: job.exclusive},
{sharedNode: {contains: job.resources[0].hostname }},
{selfJobId: {neq: job.jobId }},
{selfStartTime: job.startTime, selfDuration: job.duration}
]
const parallelJobs = operationStore(`
query($filter: [JobFilter!]!){
jobsParallel(filter: $filter) {
items { id, jobId }
count
}
}`, {
filter
})
if (showParallelJobs) {
query(parallelJobs)
}
</script>
<div>
@@ -57,6 +80,19 @@
{scrambleNames ? scramble(job.project) : job.project}
</a>
{/if}
{#if showParallelJobs && $parallelJobs.data != null}
<br/>
<Icon name="diagram-3-fill"/>
{#if $parallelJobs.data.jobsParallel.count == 0}
No Parallel Jobs
{:else}
{#each $parallelJobs.data.jobsParallel.items as pjob, index}
<a href="/monitoring/job/{pjob.id}" target="_blank">
{pjob.jobId}{#if index != $parallelJobs.data.jobsParallel.count - 1},{/if}
</a>
{/each}
{/if}
{/if}
</p>
<p>