diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 0836ebe54e3..7fc3a5c8993 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - ### Fixed +- Jobs status is no longer polled if jobs are not enabled, avoiding backend logging spam [#5761](https://github.com/scalableminds/webknossos/pull/5761) - Fixed a bug that windows user could not open the context menu as it instantly closed after opening. [#5756](https://github.com/scalableminds/webknossos/pull/5756). ### Removed diff --git a/app/controllers/JobsController.scala b/app/controllers/JobsController.scala index ffd58750f30..ed0c19f4af3 100644 --- a/app/controllers/JobsController.scala +++ b/app/controllers/JobsController.scala @@ -13,13 +13,14 @@ import oxalis.telemetry.SlackNotificationService import play.api.i18n.Messages import play.api.libs.json._ import play.api.mvc.{Action, AnyContent} -import utils.ObjectId +import utils.{ObjectId, WkConf} import scala.concurrent.ExecutionContext class JobsController @Inject()(jobDAO: JobDAO, sil: Silhouette[WkEnv], jobService: JobService, + wkconf: WkConf, slackNotificationService: SlackNotificationService, organizationDAO: OrganizationDAO)(implicit ec: ExecutionContext) extends Controller { @@ -38,6 +39,7 @@ class JobsController @Inject()(jobDAO: JobDAO, def list: Action[AnyContent] = sil.SecuredAction.async { implicit request => for { + _ <- bool2Fox(wkconf.Features.jobsEnabled) ?~> "job.disabled" _ <- jobService.updateCeleryInfos() jobs <- jobDAO.findAll jobsJsonList <- Fox.serialCombined(jobs.sortBy(-_.created))(jobService.publicWrites) @@ -46,6 +48,7 @@ class JobsController @Inject()(jobDAO: JobDAO, def get(id: String): Action[AnyContent] = sil.SecuredAction.async { implicit request => for { + _ <- bool2Fox(wkconf.Features.jobsEnabled) ?~> "job.disabled" _ <- jobService.updateCeleryInfos() job <- jobDAO.findOne(ObjectId(id)) js <- jobService.publicWrites(job) diff --git a/app/models/job/Job.scala b/app/models/job/Job.scala index 549708a7852..2a573a2c68b 100644 --- a/app/models/job/Job.scala +++ b/app/models/job/Job.scala @@ -247,7 +247,7 @@ class JobService @Inject()(wkConf: WkConf, def runJob(command: String, commandArgs: JsObject, owner: User): Fox[Job] = for { - _ <- bool2Fox(wkConf.Features.jobsEnabled) ?~> "jobs.disabled" + _ <- bool2Fox(wkConf.Features.jobsEnabled) ?~> "job.disabled" argsWrapped = Json.obj("kwargs" -> commandArgs) result <- flowerRpc(s"/api/task/async-apply/tasks.$command") .postWithJsonResponse[JsValue, Map[String, JsValue]](argsWrapped) diff --git a/frontend/javascripts/dashboard/dataset_view.js b/frontend/javascripts/dashboard/dataset_view.js index f31615a6ab6..be4e970591f 100644 --- a/frontend/javascripts/dashboard/dataset_view.js +++ b/frontend/javascripts/dashboard/dataset_view.js @@ -14,7 +14,6 @@ import { HourglassOutlined, } from "@ant-design/icons"; import { PropTypes } from "@scalableminds/prop-types"; -import useInterval from "@use-it/interval"; import type { APIJob, APIUser } from "types/api_flow_types"; import { OptionCard } from "admin/onboarding"; @@ -83,7 +82,9 @@ function DatasetView(props: Props) { if (state.datasetFilteringMode != null) { setDatasetFilteringMode(state.datasetFilteringMode); } - getJobs().then(newJobs => setJobs(newJobs)); + if (features().jobsEnabled) { + getJobs().then(newJobs => setJobs(newJobs)); + } context.fetchDatasets({ applyUpdatePredicate: _newDatasets => { // Only update the datasets when there are none currently. @@ -98,9 +99,15 @@ function DatasetView(props: Props) { }); }, []); - useInterval(() => { - getJobs().then(newJobs => setJobs(newJobs)); - }, CONVERSION_JOBS_REFRESH_INTERVAL); + useEffect(() => { + let interval = null; + if (features().jobsEnabled) { + interval = setInterval(() => { + getJobs().then(newJobs => setJobs(newJobs)); + }, CONVERSION_JOBS_REFRESH_INTERVAL); + } + return () => (interval != null ? clearInterval(interval) : undefined); + }, []); useEffect(() => { persistence.persist(history, { diff --git a/tools/postgres/diff_schema.js b/tools/postgres/diff_schema.js index 0bc4598effc..4d062ac4fc0 100755 --- a/tools/postgres/diff_schema.js +++ b/tools/postgres/diff_schema.js @@ -59,7 +59,7 @@ function initTmpDB() { .toString() .trim(); // "trim" to remove the line break if (dbName !== tempDbName) { - console.log("Wrong dbName"); + console.log("Wrong temporary dbName, got", dbName, "expected", tempDbName); process.exit(1); } const dbHost = execSync(scriptdir + "/db_host.sh", { env: { POSTGRES_URL: postgresUrl } })