Clinical-Genomics / cg

Glue between Clinical Genomics apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not exiting multi-case upload process when one gens upload fails

raysloks opened this issue · comments

As mentioned in #3197, it'd be good to not exit the upload process entirely when singular Gens samples fail to upload to a duplicate key error.

I'm not entirely sure how to accomplish this in the best way. Would simply putting a try except CalledProcessError somewhere like here

self.process.run_command(parameters=load_call_params, dry_run=self.dry_run)
be enough?

Hmm I think a try/except would be nice, but I would rather have it where the samples are being looped through. There could be benefits to having an error raised from GensAPI.load which is caught by the upload_to_gens method, say if you would want a method which uploads only a single sample. There it might make sense that an error is raised.

Hmmm, I might have misunderstood whoever originally noted this problem.
cg seems to already separate the cases here

cg/cg/cli/upload/base.py

Lines 116 to 121 in 985acfb

try:
context.invoke(upload, case_id=case_id)
except Exception:
LOG.error(f"Case {case_id} upload failed")
LOG.error(traceback.format_exc())
exit_code = 1

The command still exits with an error code, but it continues to upload other cases after an exception is caught.
I've taken a look at chanjo and genotype, and they both simply print a warning when there's a duplicate. However, they respect the re_upload/restart/force flag.
For consistency's sake I guess it might be best to, as you say, have upload_to_gens catch an exception, but then just print a warning, and to have Gens respect the re_upload/restart flag?

@raysloks Sounds good! Let's make it so.