Skip to content

Commit

Permalink
fix job check for simularium
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Aug 16, 2024
1 parent a94b9ef commit 8ba5fb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions compose_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ async def generate_simularium_file(
):
job_id = "files-generate-simularium-file" + str(uuid.uuid4())
_time = db_connector.timestamp()
upload_prefix = f"uploads/{job_id}/"
bucket_prefix = f"gs://{BUCKET_NAME}/" + upload_prefix
upload_prefix, bucket_prefix = file_upload_prefix(job_id)
uploaded_file_location = await write_uploaded_file(job_id=job_id, uploaded_file=uploaded_file, bucket_name=BUCKET_NAME, extension='.txt')

# new simularium job in db
Expand Down
8 changes: 7 additions & 1 deletion compose_worker/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dotenv import load_dotenv
from pymongo.collection import Collection as MongoCollection

from workers import SimulationRunWorker, VerificationWorker
from workers import SimulationRunWorker, VerificationWorker, FilesWorker, CompositionWorker
from shared import BaseClass, MongoDbConnector, unique_id, JobStatus, DatabaseCollections
from log_config import setup_logging

Expand Down Expand Up @@ -60,6 +60,12 @@ async def check():
elif job_id.startswith('verification'):
# otherwise: create new worker with job
worker = VerificationWorker(job=pending_job)
# check: files
elif job_id.startswith('files'):
worker = FilesWorker(job=pending_job)
# check: composition
elif job_id.startswith('composition-run'):
worker = CompositionWorker(job=pending_job)

# change job status for client by inserting a new in progress job
in_progress_job = await self.db_connector.insert_job_async(collection_name=DatabaseCollections.IN_PROGRESS_JOBS.value, job_id=job_id, timestamp=self.db_connector.timestamp(), status=JobStatus.IN_PROGRESS.value)
Expand Down

0 comments on commit 8ba5fb3

Please sign in to comment.