{ "info": { "author": "Antoine Grigis", "author_email": "antoine.grigis@cea.fr", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development" ], "description": ".. contents::\n\n\n|Travis|_ |Coveralls|_ |Python27|_ |Python34|_ |PyPi|_ \n\n.. |Travis| image:: https://travis-ci.org/AGrigis/hopla.svg?branch=master\n.. _Travis: https://travis-ci.org/AGrigis/hopla\n\n.. |Coveralls| image:: https://coveralls.io/repos/AGrigis/hopla/badge.svg?branch=master&service=github\n.. _Coveralls: https://coveralls.io/github/AGrigis/hopla\n\n.. |Python27| image:: https://img.shields.io/badge/python-2.7-blue.svg\n.. _Python27: https://badge.fury.io/py/hopla\n\n.. |Python34| image:: https://img.shields.io/badge/python-3.4-blue.svg\n.. _Python34: https://badge.fury.io/py/hopla\n\n.. |PyPi| image:: https://badge.fury.io/py/hopla.svg\n.. _PyPi: https://badge.fury.io/py/hopla\n\n\nEasy to use pure-Python scheduler. Visit also the\n`API documentation `_.\n\nOverview\n========\n\nWith the increasing amount of data to be treated, efficient scaling strategies\nare necessary. This observation made me start 'hopla' which provides:\n\n- a scheduler that produces human readable outputs.\n- a converter that enables to execute kilometer command lines\n- workers that enable local or cluster executions. \n\n\nUsage\n=====\n\nThe proposed module has been currently developped to execute Python scripts.\nConsider the following demonstration script that lists an input folder (the\nlatter is available in the 'hopla.demo.my_ls_script' module)::\n\n #! /usr/bin/env python\n ##########################################################################\n # Hopla - Copyright (C) AGrigis, 2015\n # Distributed under the terms of the CeCILL-B license, as published by\n # the CEA-CNRS-INRIA. Refer to the LICENSE file or to\n # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html\n # for details.\n ##########################################################################\n\n # Bredala import\n try:\n import bredala\n bredala.USE_PROFILER = False\n bredala.register(\"os.path\", names=[\"listdir\"])\n except:\n pass\n\n # System import\n from datetime import datetime\n import argparse\n import os\n\n # Parameters to keep trace\n __hopla__ = [\"runtime\", \"inputs\", \"outputs\"]\n\n\n def is_directory(dirarg):\n \"\"\" Type for argparse - checks that directory exists.\n \"\"\"\n if not os.path.isdir(dirarg):\n raise argparse.ArgumentError(\n \"The directory '{0}' does not exist!\".format(dirarg))\n return dirarg\n\n\n parser = argparse.ArgumentParser(description=\"List a directory.\")\n required = parser.add_argument_group(\"required arguments\")\n required.add_argument(\n \"-d\", \"--dir\", dest=\"dir\", required=True, metavar=\"PATH\",\n help=\"a valid directory to be listed.\", type=is_directory)\n parser.add_argument(\n \"-b\", \"--fbreak\", dest=\"fbreak\", action=\"store_true\",\n help=\"a activated raise a ValueError.\")\n required.add_argument(\n \"-l\", \"--mylist\", dest=\"mylist\", nargs=\"+\", type=int, required=True,\n help=\"a list that will be printed.\")\n parser.add_argument(\n \"-v\", \"--verbose\", dest=\"verbose\", type=int, choices=[0, 1, 2], default=0,\n help=\"increase the verbosity level: 0 silent, [1, 2] verbose.\")\n args = parser.parse_args()\n\n directory = args.dir\n break_flag = args.fbreak\n mylist = args.mylist\n runtime = {\n \"timestamp\": datetime.now().isoformat()\n }\n inputs = {\n \"directory\": directory,\n \"break_flag\": break_flag,\n \"mylist\": mylist\n }\n outputs = None\n if break_flag:\n raise ValueError(\"BREAK ACTIVATED.\")\n files = os.listdir(directory)\n print(\"[res] --------\", mylist)\n if args.verbose > 0:\n print(\"[res] --------\", files)\n outputs = {\n \"files\": files\n }\n\nNote the '__hopla__' list that specifies which parameters will be dispalyed in\nthe scheduler execution log. This mechanism is usefull to keep trace of\nimportant script elements. The scaled execution of this script on two CPUs is\nrealized using a simple call::\n\n # System import\n from pprint import pprint\n\n # Hopla import\n from hopla.converter import hopla\n import hopla as root\n\n # Define script parameters\n apath = os.path.join(os.path.abspath(os.path.dirname(root.__file__)), \"demo\")\n script = os.path.join(apath, \"my_ls_script.py\")\n\n # Local execution\n status, exitcodes = hopla(\n script, hopla_iterative_kwargs=[\"d\", \"b\"], verbose=0, l=[1, 2],\n b=[False, True, False], d=[apath, apath, apath], hopla_verbose=1,\n hopla_cpus=2)\n pprint(status)\n pprint(exitcodes)\n\nAfter the execution call (through the hopla function), exit codes are\ninspected. The 'hopla_verbose' has been set to one, some logging information\nhas been displayed::\n\n 2016-08-02 15:59:26,562 - INFO - Using 'hopla' version '1.0.2'.\n 2016-08-02 15:59:26,562 - INFO - For exitcode values:\n = 0 - no error was produced.\n > 0 - the process had an error, and exited with that code.\n < 0 - the process was killed with a signal of -1 * exitcode.\n 2016-08-02 15:59:26,927 - INFO - job_0.inputs = {'directory': '/home/ag239446/git/hopla/hopla/demo', 'break_flag': False, 'mylist': [1, 2]}\n 2016-08-02 15:59:26,928 - INFO - job_0.exitcode = 0\n 2016-08-02 15:59:26,928 - INFO - job_0.cmd = ['/home/ag239446/git/hopla/hopla/demo/my_ls_script.py', '--dir', '/home/ag239446/git/hopla/hopla/demo', '--mylist', '1', '2', '--verbose', '1']\n 2016-08-02 15:59:26,928 - INFO - job_0.outputs = {'files': ['my_ls_script.py', 'demo.py']}\n 2016-08-02 15:59:26,928 - INFO - job_0.runtime = {'timestamp': '2016-08-02T15:59:26.926153'}\n 2016-08-02 15:59:26,928 - INFO - job_1.inputs = {'directory': '/home/ag239446/git/hopla/hopla/demo', 'break_flag': True, 'mylist': [1, 2]}\n 2016-08-02 15:59:26,929 - INFO - job_1.exitcode = 1 - 'Traceback (most recent call last):\n File \"/home/ag239446/git/hopla/hopla/workers.py\", line 70, in worker\n exec(ofile.read(), job_status)\n File \"\", line 65, in \n ValueError: BREAK ACTIVATED.\n '\n 2016-08-02 15:59:26,929 - INFO - job_1.cmd = ['/home/ag239446/git/hopla/hopla/demo/my_ls_script.py', '-b', '--dir', '/home/ag239446/git/hopla/hopla/demo', '--mylist', '1', '2', '--verbose', '1']\n 2016-08-02 15:59:26,929 - INFO - job_1.outputs = None\n 2016-08-02 15:59:26,929 - INFO - job_1.runtime = {'timestamp': '2016-08-02T15:59:26.926772'}\n 2016-08-02 15:59:26,979 - INFO - job_2.inputs = {'directory': '/home/ag239446/git/hopla/hopla/demo', 'break_flag': False, 'mylist': [1, 2]}\n 2016-08-02 15:59:26,979 - INFO - job_2.exitcode = 0\n 2016-08-02 15:59:26,979 - INFO - job_2.cmd = ['/home/ag239446/git/hopla/hopla/demo/my_ls_script.py', '--dir', '/home/ag239446/git/hopla/hopla/demo', '--mylist', '1', '2', '--verbose', '1']\n 2016-08-02 15:59:26,979 - INFO - job_2.outputs = {'files': ['my_ls_script.py', 'demo.py']}\n 2016-08-02 15:59:26,979 - INFO - job_2.runtime = {'timestamp': '2016-08-02T15:59:26.969334'}\n {'job_0': 0, 'job_1': 1, 'job_2': 0}\n\n\nPerspectives\n============\n\nIt will be nice to generalize some concepts (ie., accept different kind\nof scripts).", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/AGrigis/hopla", "keywords": "", "license": "GPL 2+", "maintainer": "", "maintainer_email": "", "name": "hopla", "package_url": "https://pypi.org/project/hopla/", "platform": "any", "project_url": "https://pypi.org/project/hopla/", "project_urls": { "Homepage": "http://github.com/AGrigis/hopla" }, "release_url": "https://pypi.org/project/hopla/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "|Travis|_ |Coveralls|_ |Python27|_ |Python34|_ |PyPi|_", "version": "1.0.5" }, "last_serial": 5588636, "releases": { "1.0.0": [], "1.0.1": [ { "comment_text": "", "digests": { "md5": "68e8a8364c5e6259bb4b5a9f82ce17df", "sha256": "80b3be27e8c5d2716246b9aa1a350a2ed6eeac419e5306f2ea429a047c47e180" }, "downloads": -1, "filename": "hopla-1.0.1.tar.gz", "has_sig": false, "md5_digest": "68e8a8364c5e6259bb4b5a9f82ce17df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10539, "upload_time": "2016-04-18T08:34:47", "url": "https://files.pythonhosted.org/packages/d4/bc/596d8f5d5e32a2b513ebf9ac2b04183ac3cc2d9a976f7542b91d986f7142/hopla-1.0.1.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "e3148b85bb6825efb88b99b5d3182b55", "sha256": "3f8a85a2bd09cab340eb401bc45de5d1c6dd472793d8cded9ab32e44c6a5e0fc" }, "downloads": -1, "filename": "hopla-1.0.4.tar.gz", "has_sig": false, "md5_digest": "e3148b85bb6825efb88b99b5d3182b55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12041, "upload_time": "2019-07-24T13:04:12", "url": "https://files.pythonhosted.org/packages/ea/ee/7cbc8a4fc89fb59354128fe980476d4de06855c2489c971850f37a2bc9a4/hopla-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "d82b249c608492d4cb03722542a7018c", "sha256": "4e10f1a23c8a956e8ae3d69dcb62f3f5a5a4e2703ec2ce6486fc7f2068ba103c" }, "downloads": -1, "filename": "hopla-1.0.5.tar.gz", "has_sig": false, "md5_digest": "d82b249c608492d4cb03722542a7018c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12023, "upload_time": "2019-07-26T11:44:59", "url": "https://files.pythonhosted.org/packages/47/87/5f124532f55bf7a8fca6c5e99a84cbf344a6b00e209e386521626c823733/hopla-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d82b249c608492d4cb03722542a7018c", "sha256": "4e10f1a23c8a956e8ae3d69dcb62f3f5a5a4e2703ec2ce6486fc7f2068ba103c" }, "downloads": -1, "filename": "hopla-1.0.5.tar.gz", "has_sig": false, "md5_digest": "d82b249c608492d4cb03722542a7018c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12023, "upload_time": "2019-07-26T11:44:59", "url": "https://files.pythonhosted.org/packages/47/87/5f124532f55bf7a8fca6c5e99a84cbf344a6b00e209e386521626c823733/hopla-1.0.5.tar.gz" } ] }