Git Product home page Git Product logo

clusterjob's People

Contributors

goerz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clusterjob's Issues

Prologue and epilogue scripts on remote machine

Is it possible to run setup/teardown scripts on the remote machine when using JobScript with SSH?

I need to source a script on the remote that sets up the LSF environment before it will let me use bsub.

Race condition when loading AsyncResult from dump file

I'm using clusterjob with doit and am finding that in some cases, I get an error because of the delay between submitting the job and it being accepted appearing in (in this case) bjobs -a:

PythonAction Error
Traceback (most recent call last):
  File "/path/to/repo/virtualenv/lib/python3.6/site-packages/doit/action.py", line 403, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/path/to/repo/utilities.py", line 117, in wait_for_clusterjob
    run.wait()
  File "/path/to/repo/virtualenv/lib/python3.6/site-packages/clusterjob/__init__.py", line 1013, in wait
    status = self.status
  File "/path/to/repo/virtualenv/lib/python3.6/site-packages/clusterjob/__init__.py", line 938, in status
    status = self.backend.get_status(response, finished=False)
  File "/path/to/repo/virtualenv/lib/python3.6/site-packages/clusterjob/backends/lsf.py", line 103, in get_status
    status = line[status_pos:].split()[0]
IndexError: list index out of range

It seems to be that because the job ID doesn't exist yet in the bjobs -a list, it can't be parsed from there so it raises the IndexError.

My dodo file roughly follows the doit example in the documentation, I'm running a command on a large number of data accessions, and my tasks are roughly of the form:

yield {
    'name': f'submit_{accession}',
    'actions': [
        (submit_clusterjob, (command, accession), {})
    ]
}

yield {
    'name': f'wait_{accession}',
    'actions': [
        (wait_for_clusterjob, (accession,), {})
    ]
}
def submit_clusterjob(body, jobname, runfolder, jobargs=(), jobkwargs={}):

    jobscript = clusterjob.JobScript(
        body,
        jobname,
        *jobargs,
        **jobkwargs
    )

    run = jobscript.submit(force=True)
    run.dump(os.path.join(runfolder, jobname))


def wait_for_clusterjob(jobname, runfolder):

    run = clusterjob.AsyncResult.load(os.path.join(runfolder, jobname))
    run.wait()
    os.unlink(os.path.join(runfolder, jobname))
    return run.successful()

Is there any way to ensure that the job has been fully submitted and is showing in bjobs -a allowing run.wait to be called without a hacky time.sleep or similar?

Many thanks,

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.