Skip to content

Commit

Permalink
Fix processing job list (#8323)
Browse files Browse the repository at this point in the history
* include backend organization name in frontend orga id and improve conditions for job description rendering

* remove dev edits

* format comment

* format comment

* address review: improve if condition

* remove application.conf edit
  • Loading branch information
knollengewaechs authored Jan 21, 2025
1 parent be83f8e commit eb1423c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 42 deletions.
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function transformBackendJobToAPIJob(job: any): APIJob {
type: job.command,
datasetName: job.commandArgs.dataset_name,
datasetDirectoryName: job.commandArgs.dataset_directory_name,
organizationId: job.commandArgs.organization_id,
organizationId: job.commandArgs.organization_id || job.commandArgs.organization_name,
layerName: job.commandArgs.layer_name || job.commandArgs.volume_layer_name,
annotationLayerName: job.commandArgs.annotation_layer_name,
boundingBox: job.commandArgs.bbox,
Expand Down
63 changes: 22 additions & 41 deletions frontend/javascripts/admin/job/job_list_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,20 @@ function JobListView() {
setSearchQuery(event.target.value);
}

function getLinkToDataset(job: APIJob) {
// prefer updated link over legacy link.
if (job.datasetId != null)
return `/datasets/${getReadableURLPart({ name: job.datasetName || "unknown_name", id: job.datasetId })}/view`;
if (job.organizationId != null && (job.datasetName != null || job.datasetDirectoryName != null))
return `/datasets/${job.organizationId}/${job.datasetDirectoryName || job.datasetName}/view`;
return null;
}

function renderDescription(__: any, job: APIJob) {
const linkToDataset =
job.datasetId != null
? `/datasets/${getReadableURLPart({ name: job.datasetName || "unknown_name", id: job.datasetId })}/view` // prefer updated link over legacy link.
: `/datasets/${job.organizationId || ""}/${job.datasetDirectoryName || job.datasetName}/view`;
const linkToDataset = getLinkToDataset(job);
if (job.type === APIJobType.CONVERT_TO_WKW && job.datasetName) {
return <span>{`Conversion to WKW of ${job.datasetName}`}</span>;
} else if (job.type === APIJobType.EXPORT_TIFF && job.organizationId && job.datasetName) {
} else if (job.type === APIJobType.EXPORT_TIFF && linkToDataset != null) {
const labelToAnnotationOrDataset =
job.annotationId != null ? (
<Link to={`/annotations/${job.annotationId}`}>
Expand All @@ -180,33 +186,28 @@ function JobListView() {
{job.ndBoundingBox ? formatWkLibsNdBBox(job.ndBoundingBox) : job.boundingBox})
</span>
);
} else if (job.type === APIJobType.RENDER_ANIMATION && job.organizationId && job.datasetName) {
} else if (job.type === APIJobType.RENDER_ANIMATION && linkToDataset != null) {
return (
<span>
Animation rendering for layer {job.layerName} of dataset{" "}
<Link to={linkToDataset}>{job.datasetName}</Link>
</span>
);
} else if (job.type === APIJobType.COMPUTE_MESH_FILE && job.organizationId && job.datasetName) {
} else if (job.type === APIJobType.COMPUTE_MESH_FILE && linkToDataset != null) {
return (
<span>
Mesh file computation for <Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.COMPUTE_SEGMENT_INDEX_FILE &&
job.organizationId &&
job.datasetName
) {
} else if (job.type === APIJobType.COMPUTE_SEGMENT_INDEX_FILE && linkToDataset != null) {
return (
<span>
Segment index file computation for <Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.FIND_LARGEST_SEGMENT_ID &&
job.organizationId &&
job.datasetName &&
linkToDataset != null &&
job.layerName
) {
return (
Expand All @@ -215,24 +216,14 @@ function JobListView() {
<Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.INFER_NUCLEI &&
job.organizationId &&
job.datasetName &&
job.layerName
) {
} else if (job.type === APIJobType.INFER_NUCLEI && linkToDataset != null && job.layerName) {
return (
<span>
Nuclei inferral for layer {job.layerName} of{" "}
<Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.INFER_NEURONS &&
job.organizationId &&
job.datasetName &&
job.layerName
) {
} else if (job.type === APIJobType.INFER_NEURONS && linkToDataset != null && job.layerName) {
return (
<span>
Neuron inferral for layer {job.layerName} of{" "}
Expand All @@ -241,8 +232,7 @@ function JobListView() {
);
} else if (
job.type === APIJobType.INFER_MITOCHONDRIA &&
job.organizationId &&
job.datasetName &&
linkToDataset != null &&
job.layerName
) {
return (
Expand All @@ -251,23 +241,14 @@ function JobListView() {
<Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.ALIGN_SECTIONS &&
job.organizationId &&
job.datasetName &&
job.layerName
) {
} else if (job.type === APIJobType.ALIGN_SECTIONS && linkToDataset != null && job.layerName) {
return (
<span>
Align sections for layer {job.layerName} of{" "}
<Link to={linkToDataset}>{job.datasetName}</Link>{" "}
</span>
);
} else if (
job.type === APIJobType.MATERIALIZE_VOLUME_ANNOTATION &&
job.organizationId &&
job.datasetName
) {
} else if (job.type === APIJobType.MATERIALIZE_VOLUME_ANNOTATION && linkToDataset != null) {
return (
<span>
Materialize annotation for {job.layerName ? ` layer ${job.layerName} of ` : " "}
Expand All @@ -277,15 +258,15 @@ function JobListView() {
: null}
</span>
);
} else if (job.type === APIJobType.TRAIN_MODEL && job.organizationId) {
} else if (job.type === APIJobType.TRAIN_MODEL) {
const numberOfTrainingAnnotations = job.trainingAnnotations.length;
return (
<span>
{`Train model on ${numberOfTrainingAnnotations} ${Utils.pluralize("annotation", numberOfTrainingAnnotations)}. `}
{getShowTrainingDataLink(job.trainingAnnotations)}
</span>
);
} else if (job.type === APIJobType.INFER_WITH_MODEL && job.organizationId) {
} else if (job.type === APIJobType.INFER_WITH_MODEL && linkToDataset != null) {
return (
<span>
Run AI segmentation with custom model on <Link to={linkToDataset}>{job.datasetName}</Link>
Expand Down

0 comments on commit eb1423c

Please sign in to comment.