Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrOertlin committed Sep 2, 2024
1 parent b9c9791 commit 8b124b4
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions cg/cli/deliver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,45 @@ def deliver():
LOG.info("Running CG deliver")


@deliver.command(name="rsync")
@DRY_RUN
@TICKET_ID_ARG
@click.pass_obj
def rsync(context: CGConfig, ticket: str, dry_run: bool):
"""The folder generated using the "cg deliver analysis" command will be
rsynced with this function to the customers inbox on the delivery server
"""
tb_api: TrailblazerAPI = context.trailblazer_api
rsync_api: RsyncAPI = RsyncAPI(config=context)
slurm_id = rsync_api.run_rsync_on_slurm(ticket=ticket, dry_run=dry_run)
LOG.info(f"Rsync to the delivery server running as job {slurm_id}")
rsync_api.add_to_trailblazer_api(
tb_api=tb_api, slurm_job_id=slurm_id, ticket=ticket, dry_run=dry_run
)


@deliver.command(name="analysis")
@DRY_RUN
@DELIVERY_TYPE
@click.option("-c", "--case-id", help="Deliver the files for a specific case")
@click.option(
"-t", "--ticket", type=str, help="Deliver the files for ALL cases connected to a ticket"
)
@FORCE_ALL
@IGNORE_MISSING_BUNDLES
@click.pass_obj
def deliver_analysis(
context: CGConfig,
case_id: str | None,
ticket: str | None,
delivery_type: list[str],
dry_run: bool,
force_all: bool,
ignore_missing_bundles: bool,
):
"""Deliver analysis files to customer inbox
"""Deliver analysis files to customer inbox on the HPC.
Files can be delivered either on case level or for all cases connected to a ticket.
Any of those needs to be specified.
"""
inbox: str = context.delivery_path
if not (case_id or ticket):
LOG.info("Please provide a case-id or ticket-id")
return
inbox: str = context.delivery_path
if not inbox:
LOG.info("Please specify the root path for where files should be delivered")
return
service_builder = DeliveryServiceBuilder(
store=context.status_db, hk_api=context.housekeeper_api
)
Expand All @@ -101,23 +109,6 @@ def deliver_analysis(
)


@deliver.command(name="rsync")
@DRY_RUN
@TICKET_ID_ARG
@click.pass_obj
def rsync(context: CGConfig, ticket: str, dry_run: bool):
"""The folder generated using the "cg deliver analysis" command will be
rsynced with this function to the customers inbox on the delivery server
"""
tb_api: TrailblazerAPI = context.trailblazer_api
rsync_api: RsyncAPI = RsyncAPI(config=context)
slurm_id = rsync_api.run_rsync_on_slurm(ticket=ticket, dry_run=dry_run)
LOG.info(f"Rsync to the delivery server running as job {slurm_id}")
rsync_api.add_to_trailblazer_api(
tb_api=tb_api, slurm_job_id=slurm_id, ticket=ticket, dry_run=dry_run
)


@deliver.command(name="concatenate")
@DRY_RUN
@TICKET_ID_ARG
Expand Down

0 comments on commit 8b124b4

Please sign in to comment.