Create missing queues when starting the AWS dynamic cluster management service

This commit is contained in:
allegroai 2020-03-05 14:08:32 +02:00
parent 47bcd3839a
commit 01f57c1e44

View File

@ -444,6 +444,12 @@
" os.environ[\"TRAINS_API_SECRET_KEY\"] = TRAINS_SECRET_KEY\n", " os.environ[\"TRAINS_API_SECRET_KEY\"] = TRAINS_SECRET_KEY\n",
" api_client = APIClient()\n", " api_client = APIClient()\n",
"\n", "\n",
" # Verify the requested queues exist and create those that doesn't exist\n",
" all_queues = [q.name for q in list(api_client.queues.get_all())]\n",
" missing_queues = [q for q in QUEUES if q not in all_queues]\n",
" for q in missing_queues:\n",
" api_client.queues.create(q)\n",
"\n",
" idle_workers = {}\n", " idle_workers = {}\n",
" while True:\n", " while True:\n",
" queue_name_to_id = {\n", " queue_name_to_id = {\n",