-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(new delivery flow) (#3598) (major)
# Description Replaces the delivery api with a new delivery service.
- Loading branch information
1 parent
8901c8d
commit 6a221f1
Showing
88 changed files
with
2,613 additions
and
1,906 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import logging | ||
from datetime import datetime | ||
from pathlib import Path | ||
|
||
from cg.constants import Workflow | ||
from cg.services.deliver_files.deliver_files_service.deliver_files_service import ( | ||
DeliverFilesService, | ||
) | ||
from cg.services.deliver_files.deliver_files_service.deliver_files_service_factory import ( | ||
DeliveryServiceFactory, | ||
) | ||
from cg.store.models import Case, Analysis | ||
from cg.store.store import Store | ||
|
||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def deliver_raw_data_for_analyses( | ||
analyses: list[Analysis], | ||
status_db: Store, | ||
delivery_path: Path, | ||
service_builder: DeliveryServiceFactory, | ||
dry_run: bool, | ||
): | ||
"""Deliver raw data for a list of analyses""" | ||
for analysis in analyses: | ||
try: | ||
case: Case = analysis.case | ||
delivery_service: DeliverFilesService = service_builder.build_delivery_service( | ||
delivery_type=case.data_delivery, | ||
workflow=Workflow.FASTQ, | ||
) | ||
|
||
delivery_service.deliver_files_for_case( | ||
case=case, delivery_base_path=delivery_path, dry_run=dry_run | ||
) | ||
status_db.update_analysis_upload_started_at( | ||
analysis_id=analysis.id, upload_started_at=datetime.now() | ||
) | ||
except Exception as error: | ||
status_db.update_analysis_upload_started_at( | ||
analysis_id=analysis.id, upload_started_at=None | ||
) | ||
LOG.error(f"Could not deliver files for analysis {analysis.id}: {error}") | ||
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.