Git Product home page Git Product logo

Comments (6)

lucpeterson avatar lucpeterson commented on August 20, 2024 1

I've seen users have success with this by adding a step at the end of their workflow that looks something like this (for workers run in an sbatch script):

- description: Kill any active workers and cancel all of my Merlin batch jobs
  name: kill
  run:
    cmd: |
        # email me that we're finishing
        echo "All done with simulation run in $(MERLIN_WORKSPACE)" | mail -s "Merlin Cretin Update" [email protected]
        # kill workers
        merlin stop-workers
        # cancel your depending jobs
        scancel -u $USER --name Merlin --state=PENDING
        # cancel your active jobs
        scancel -u $USER --name Merlin --state=RUNNING
    depends: [last_real_step]

Basically what this does is

  1. Sends you an email with the name of the ensemble that's done
  2. Sends a kill command to all of the workers, which gets them to shut down gracefully
  3. Uses slurm to cancel all of your jobs with the name "Merlin" in them

It would be good for us to document this snippet somewhere. It'll need to be battle tested, and perhaps modified for extra features (like only kill the workers associated with the steps in this workflow)

from merlin.

lucpeterson avatar lucpeterson commented on August 20, 2024 1

my original reply doesn't work because of this bug #129
... but ...
#182 introduces the new exit code $(MERLIN_STOP_WORKERS) which sends a delayed kill signal to all the workers. $(MERLIN_HARD_FAIL) will alternatively stop the workers connected to that specific step's queue

from merlin.

koning avatar koning commented on August 20, 2024 1

Yes, this has been addressed with the new monitor.

from merlin.

lucpeterson avatar lucpeterson commented on August 20, 2024

As an alternative, you can have a process living outside of the run-workers call but in your batch script that checks the status of the workflow periodically and decide when to break out of the job

see the merlin status command

from merlin.

ben-bay avatar ben-bay commented on August 20, 2024

@koning would you say this issue is effectively closed with merlin monitor ?

from merlin.

ben-bay avatar ben-bay commented on August 20, 2024

@srcopela the new command merlin monitor <spec.yaml> ... has this functionality. See the docs for more details: https://merlin.readthedocs.io/en/latest/merlin_commands.html?highlight=merlin%20monitor#monitor-merlin-monitor

from merlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.