CHIMEFRB / workflow

🌊 Working in flowstate.
0 stars 0 forks source link

[BUG] `attempt.work` function triggering slack notification twice. #111

Closed odarotto closed 2 months ago

odarotto commented 2 months ago

On attempt.py, we call work.update() function twice, on L104 and then on L115, this causes that if the Work object has a Notify setting, it will trigger the slack.post_message() function every time (see https://github.com/CHIMEFRB/buckets/blob/f40e8b53cec449bc507f28707ebc2009b9390e5e/buckets/backend/crud.py#L171).

            archive.run(work, config)
            work.update()
            status = True
    except Exception as error:
        logger.error(error)
        if work:
            work.results = {"error": str(error)}
            work.products = None
            work.plots = None
            work.status = "failure"
    finally:
        if work:
            work.update()
            logger.info("work completed: ✅")
            unset_tag()
        return status