Skip to content

Commit

Permalink
hide user workers if not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
BryonLewis committed Jul 17, 2024
1 parent 954ed11 commit c388464
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions client/platform/web-girder/views/Jobs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -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;
Expand All @@ -41,6 +46,7 @@ export default defineComponent({
return {
privateQueueEnabled,
distributedWorkerEnabled,
loading,
outstandingJobs,
/* methods */
Expand Down Expand Up @@ -120,6 +126,7 @@ export default defineComponent({
</v-card-text>
</v-card>
<v-card
v-if="distributedWorkerEnabled"
outlined
>
<v-card-title>
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions server/dive_server/views_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions server/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c388464

Please sign in to comment.