Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call wk-worker nuclei inferral job #5626

Merged
merged 7 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
[Commits](https://github.com/scalableminds/webknossos/compare/21.07.0...HEAD)

### Added
-
- Added a route to call new webknossos-worker job for nuclei inferral. [#5626](https://github.com/scalableminds/webknossos/pull/5626)

### Changed
-
Expand Down
20 changes: 20 additions & 0 deletions app/controllers/JobsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,26 @@ class JobsController @Inject()(jobDAO: JobDAO,
} yield Ok(js)
}

def runInferNucleiJob(organizationName: String, dataSetName: String, layerName: Option[String]): Action[AnyContent] =
sil.SecuredAction.async { implicit request =>
log(Some(slackNotificationService.noticeFailedJobRequest)) {
for {
organization <- organizationDAO.findOneByName(organizationName) ?~> Messages("organization.notFound",
organizationName)
_ <- bool2Fox(request.identity._organization == organization._id) ?~> "job.export.notAllowed.organization" ~> FORBIDDEN
command = "infer_nuclei"
commandArgs = Json.obj(
"organization_name" -> organizationName,
"dataset_name" -> dataSetName,
"layer_name" -> layerName,
"webknossos_token" -> TracingStoreRpcClient.webKnossosToken,
)
job <- jobService.runJob(command, commandArgs, request.identity) ?~> "job.couldNotRunNucleiInferral"
js <- jobService.publicWrites(job)
} yield Ok(js)
}
}

def runExportTiffJob(organizationName: String,
dataSetName: String,
bbox: String,
Expand Down
1 change: 1 addition & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ job.notFound = Job with id {0} could not be found.
job.couldNotRunCubing = Failed to start WKW conversion job.
job.couldNotRunTiffExport = Failed to start Tiff export job.
job.couldNotRunComputeMeshFile = Failed to start mesh file computation job.
job.couldNotRunNucleiInferral = Failed to start nuclei inferral job.
job.disabled = Long-running jobs are not enabled for this webKnossos instance.
job.export.fileNotFound = Exported file not found. The link may be expired.
job.export.tiff.invalidBoundingBox = The selected bounding box could not be parsed, must be x,y,z,width,height,depth
Expand Down
1 change: 1 addition & 0 deletions conf/webknossos.latest.routes
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,4 @@ GET /jobs/:id/downloadExport/:exportFileName c
GET /jobs/run/convertToWkw/:organizationName/:dataSetName controllers.JobsController.runConvertToWkwJob(organizationName: String, dataSetName: String, scale: String)
GET /jobs/run/computeMeshFile/:organizationName/:dataSetName controllers.JobsController.runComputeMeshFileJob(organizationName: String, dataSetName: String, layerName: String, mag: String, agglomerateView: Option[String])
GET /jobs/run/exportTiff/:organizationName/:dataSetName controllers.JobsController.runExportTiffJob(organizationName: String, dataSetName: String, bbox: String, layerName: Option[String], tracingId: Option[String], tracingVersion: Option[String], annotationId: Option[String], annotationType: Option[String], hideUnmappedIds: Option[Boolean], mappingName: Option[String], mappingType: Option[String])
GET /jobs/run/inferNuclei/:organizationName/:dataSetName controllers.JobsController.runInferNucleiJob(organizationName: String, dataSetName: String, layerName: Option[String])
1 change: 1 addition & 0 deletions frontend/javascripts/admin/admin_rest_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ export async function getJobs(): Promise<Array<APIJob>> {
annotationType: job.commandArgs.kwargs.annotation_type,
state: adaptJobState(job.command, job.celeryInfo.state, job.manualState),
manualState: job.manualState,
result: job.celeryInfo.result,
createdAt: job.created,
}));
}
Expand Down
28 changes: 28 additions & 0 deletions frontend/javascripts/admin/job/job_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ class JobListView extends React.PureComponent<Props, State> {
</Link>{" "}
</span>
);
} else if (
job.type === "infer_nuclei" &&
job.organizationName &&
job.datasetName &&
job.layerName
) {
return (
<span>
Nuclei inferral for layer {job.layerName} of{" "}
<Link to={`/datasets/${job.organizationName}/${job.datasetName}/view`}>
{job.datasetName}
</Link>{" "}
</span>
);
} else {
return <span>{job.type}</span>;
}
Expand Down Expand Up @@ -154,6 +168,20 @@ class JobListView extends React.PureComponent<Props, State> {
)}
</span>
);
} else if (job.type === "infer_nuclei") {
return (
<span>
{job.state === "SUCCESS" && job.result && this.props.activeUser && (
<Link
to={`/datasets/${this.props.activeUser.organization}/${job.result}/view`}
title="View Segmentation"
>
<EyeOutlined />
View
</Link>
)}
</span>
);
} else return null;
};

Expand Down
1 change: 1 addition & 0 deletions frontend/javascripts/types/api_flow_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ export type APIJob = {
+type: string,
+state: string,
+manualState: string,
+result: ?string,
+createdAt: number,
};

Expand Down