Skip to main content

Python script to submit torque jobs in a very hackish way

Project description

This is as very simple hackish hack, that allows you to any serializable python callable as a torque job.

Features:

  • Allows you to send enviorment on the other side

  • Allows to execute any callable function as a torque task

  • Allows you to launch a bunch of taska as a torque array job.

Dependencies:

  • Working python 2.7/3.4 enviorment

  • Some python dependencies (see REQUIREMENTS)

  • Working qsub command (no need for other PBS/torque stuff).

Works by serializing the enviorment and callable function to the enviorment variables (or enviorment variables and files). For serialization we use dill if avilable or pickle.

Enviorment can be initialized using arbirtary bash script — this script will be sourced before running provided python callable.

Example

Example without enviorment:

 callable = partial(print, "Hello World!")

from torqsubmit import Submitter

s = Submitter()
s.tasks = [callable]
s.submit()

Example with enviorment:

callable = partial(print, "Hello World!")

from torqsubmit._submit import Submitter

ENV = """
source ${HOME}/.bashrc
workon torque-submit
export MSG="Hello World!"
"""

def print_from_env():
    import os
    print(os.environ["MSG"])

s = Submitter()
s.tasks = [callable]
s.enviorment = ENV
s.submit()

Example submitting many tasks:

from __future__ import print_function
from functools import partial

callable = partial(print, "Hello World!")

from torqsubmit._submit import Submitter


ENV = """
source ${HOME}/.bashrc
workon torque-submit
export MSG="Hello World!"
"""


def print_from_env():
    import os
    print(os.environ["MSG"])


s = Submitter()
s.enviorment = ENV
s.tasks = [print_from_env, print_from_env]
s.submit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torque-submit-0.0.3.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file torque-submit-0.0.3.tar.gz.

File metadata

  • Download URL: torque-submit-0.0.3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for torque-submit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 eb5566094e8955d0f45d26c1e53edda6c8a43a6f2eaba6526be7a24cc29e75e4
MD5 b8138cda2fc82d040c660d0d0fc07f59
BLAKE2b-256 0c343339b0ac7abd7f5eac8f811cae251f1fd8455c0707ee0f5e827f5ba5065d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page