From c388464ee9b82b2b599e0c95e564ae87e9b1c4d4 Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Wed, 17 Jul 2024 12:32:28 -0400 Subject: [PATCH] hide user workers if not enabled --- .env.default | 1 + client/platform/web-girder/views/Jobs.vue | 7 +++++++ docker-compose.yml | 1 + server/dive_server/views_configuration.py | 11 +++++++++++ server/poetry.lock | 4 ++-- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.env.default b/.env.default index 7125f04e1..67f70b8cf 100644 --- a/.env.default +++ b/.env.default @@ -26,6 +26,7 @@ COMPOSE_PROJECT_NAME=dive # the user requires administrator permissions in rabbitmq management plugin # it is probably a different user than the celery login user above. # +#RABBITMQ_DISTRIBUTED_WORKER=0 # if the UI for distributed workers should be displayed #RABBITMQ_MANAGEMENT_USERNAME=guest #RABBITMQ_MANAGEMENT_PASSWORD=guest #RABBITMQ_MANAGEMENT_VHOST=default diff --git a/client/platform/web-girder/views/Jobs.vue b/client/platform/web-girder/views/Jobs.vue index f1756b48f..2f3a172d6 100644 --- a/client/platform/web-girder/views/Jobs.vue +++ b/client/platform/web-girder/views/Jobs.vue @@ -16,6 +16,7 @@ export default defineComponent({ const restClient = useGirderRest(); const store = useStore(); const outstandingJobs = ref(0); + const distributedWorkerEnabled = ref(false); watch(toRef(store.getters, 'Jobs/runningJobIds'), () => { restClient.get('job/queued').then(({ data }) => { @@ -30,6 +31,10 @@ export default defineComponent({ loading.value = false; } + restClient.get('dive_configuration').then((data) => { + distributedWorkerEnabled.value = !!(data.data.distributedWorker); + }); + restClient.fetchUser() .then((user) => { privateQueueEnabled.value = user.user_private_queue_enabled; @@ -41,6 +46,7 @@ export default defineComponent({ return { privateQueueEnabled, + distributedWorkerEnabled, loading, outstandingJobs, /* methods */ @@ -120,6 +126,7 @@ export default defineComponent({ diff --git a/docker-compose.yml b/docker-compose.yml index 66c9ac510..bc0e6474c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,6 +46,7 @@ services: - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-guest} - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-guest} - RABBITMQ_DEFAULT_VHOST=${RABBITMQ_DEFAULT_VHOST:-default} + - RABBITMQ_DISTRIBUTED_WORKER=${RABBITMQ_DISTRIBUTED_WORKER:-0} mongo: image: mongo:5.0 diff --git a/server/dive_server/views_configuration.py b/server/dive_server/views_configuration.py index ca6982eae..949292421 100644 --- a/server/dive_server/views_configuration.py +++ b/server/dive_server/views_configuration.py @@ -49,6 +49,7 @@ def __init__(self, resourceName): super(ConfigurationResource, self).__init__() self.resourceName = resourceName + self.route("GET", (), self.get_config) self.route("GET", ("addons",), self.get_addons) self.route("GET", ("brand_data",), self.get_brand_data) self.route("GET", ("pipelines",), self.get_pipelines) @@ -60,6 +61,16 @@ def __init__(self, resourceName): self.route("POST", ("upgrade_pipelines",), self.upgrade_pipelines) + @access.public + @autoDescribeRoute(Description("Get Configuration Information")) + def get_config(self): + env = os.environ.copy() + + distributed_worker = env.get("RABBITMQ_DISTRIBUTED_WORKER") + return { + 'distributedWorker': distributed_worker + } + @access.public @autoDescribeRoute(Description("Get custom brand data")) def get_brand_data(self): diff --git a/server/poetry.lock b/server/poetry.lock index 921d823d9..4889f912e 100644 --- a/server/poetry.lock +++ b/server/poetry.lock @@ -2101,7 +2101,7 @@ description = "PyLibTiff: a Python tiff library." optional = true python-versions = ">=3.8" files = [ - {file = "pylibtiff-0.6.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f01ba9e3e88981114122ed127d2e11f31972764a2dbe18d57dc1718d62a5f46"}, + {file = "pylibtiff-0.6.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:48a758bca6c4193fb2df694a292bef48cd8f263f486b803390645280a793318e"}, ] [package.dependencies] @@ -2353,7 +2353,7 @@ description = "binding for the libvips image processing library, API mode" optional = false python-versions = "*" files = [ - {file = "pyvips-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d9d0472b0844bbcbbc6dd3bcc6acdd488e560185122ed5c9e5f117e2fcc5bd9"}, + {file = "pyvips-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:586222efad872f31711f3fb3ac65092e8ee242dac89eab12df145aa40165c714"}, ] [package.dependencies]