falconry 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
falconry-0.1.2/.flake8 ADDED
@@ -0,0 +1,7 @@
1
+ [flake8]
2
+ max-complexity = 12
3
+ max-line-length = 127
4
+ count = True
5
+ statistics = True
6
+ import-order-style = google
7
+ exclude = docs/conf.py
@@ -0,0 +1,74 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.x"
16
+ - name: Install pypa/build
17
+ run: >-
18
+ python3 -m
19
+ pip install
20
+ build
21
+ --user
22
+ - name: Build a binary wheel and a source tarball
23
+ run: python3 -m build
24
+ - name: Store the distribution packages
25
+ uses: actions/upload-artifact@v4
26
+ with:
27
+ name: python-package-distributions
28
+ path: dist/
29
+
30
+ publish-to-testpypi:
31
+ name: Publish Python 🐍 distribution 📦 to TestPyPI
32
+ # if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33
+ needs:
34
+ - build
35
+ runs-on: ubuntu-latest
36
+
37
+ environment:
38
+ name: testpypi
39
+ url: https://test.pypi.org/p/falconry
40
+
41
+ permissions:
42
+ id-token: write # IMPORTANT: mandatory for trusted publishing
43
+
44
+ steps:
45
+ - name: Download all the dists
46
+ uses: actions/download-artifact@v4
47
+ with:
48
+ name: python-package-distributions
49
+ path: dist/
50
+ - name: Publish distribution 📦 to TestPyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
52
+ with:
53
+ repository-url: https://test.pypi.org/legacy/
54
+
55
+ publish-to-pypi:
56
+ name: >-
57
+ Publish Python 🐍 distribution 📦 to PyPI
58
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
59
+ needs:
60
+ - build
61
+ runs-on: ubuntu-latest
62
+ environment:
63
+ name: pypi
64
+ url: https://pypi.org/p/falconry
65
+ permissions:
66
+ id-token: write # IMPORTANT: mandatory for trusted publishing
67
+ steps:
68
+ - name: Download all the dists
69
+ uses: actions/download-artifact@v4
70
+ with:
71
+ name: python-package-distributions
72
+ path: dist/
73
+ - name: Publish distribution 📦 to PyPI
74
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,43 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Python package
5
+
6
+ on:
7
+ push:
8
+ branches: [ master ]
9
+ pull_request:
10
+ branches: [ master ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v2
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install flake8 mypy
30
+ #pytest
31
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32
+ - name: Lint with flake8
33
+ run: |
34
+ # stop the build if there are Python syntax errors or undefined names
35
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37
+ flake8 . --count --exit-zero --statistics
38
+ # run mypy for type checking
39
+ mypy
40
+ # TODO: implement pytest (will require mock):
41
+ #- name: Test with pytest
42
+ # run: |
43
+ # pytest
@@ -0,0 +1,35 @@
1
+ # Read the Docs configuration file for Sphinx projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the OS, Python version and other tools you might need
8
+ build:
9
+ os: ubuntu-22.04
10
+ tools:
11
+ python: "3.12"
12
+ # You can also specify other tool versions:
13
+ # nodejs: "20"
14
+ # rust: "1.70"
15
+ # golang: "1.20"
16
+
17
+ # Build documentation in the "docs/" directory with Sphinx
18
+ sphinx:
19
+ configuration: docs/conf.py
20
+ # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21
+ # builder: "dirhtml"
22
+ # Fail on all warnings to avoid broken references
23
+ # fail_on_warning: true
24
+
25
+ # Optionally build your docs in additional formats such as PDF and ePub
26
+ # formats:
27
+ # - pdf
28
+ # - epub
29
+
30
+ # Optional but recommended, declare the Python requirements required
31
+ # to build your documentation
32
+ # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33
+ python:
34
+ install:
35
+ - requirements: docs/requirements.txt
@@ -0,0 +1,19 @@
1
+ # Contributing to falconry
2
+
3
+ Any contributions or feedback are welcome, please use github issues to report any problems.
4
+
5
+ ## Development
6
+
7
+ I use flake8 and mypy to check for syntax errors, style and correct typing. These are checked in the CI but you can run them locally.
8
+
9
+ Syntax + undefined names:
10
+
11
+ python3 -m flake8 . --count --select=E9,F63,F7,F82 --show-source
12
+
13
+ Any other problems, those do not cause pipeline to fail, only show warning:
14
+
15
+ python3 -m flake8 . --count --statistics
16
+
17
+ And finally mypy for type errors:
18
+
19
+ python3 -m mypy
falconry-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Filip Nechansky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: falconry
3
+ Version: 0.1.2
4
+ Summary: A lightweight python package to create and manage your HTCondor jobs.
5
+ Project-URL: Documentation, https://falconry.readthedocs.io/en/stable/
6
+ Project-URL: Repository, https://github.com/fnechans/falconry
7
+ Project-URL: Issues, https://github.com/fnechans/falconry/issues
8
+ Author-email: Filip Nechansky <filip.nechansky@protonmail.com>
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.8
19
+ Requires-Dist: htcondor>=24.2.1
20
+ Requires-Dist: ijson>=3.3.0
21
+ Description-Content-Type: text/markdown
22
+
23
+ # falconry
24
+
25
+ ![Python package](https://github.com/fnechans/falconry/workflows/Python%20package/badge.svg)
26
+ [![Documentation Status](https://readthedocs.org/projects/falconry/badge/?version=latest)](https://falconry.readthedocs.io/en/latest/?badge=latest)
27
+
28
+ ## Introduction
29
+
30
+ Falconry is lightweight python package to create and manage your [HTCondor](https://github.com/htcondor/) jobs.
31
+ It handles things like job submission, dependent jobs, and job status checking. It periodically saves progress,
32
+ so even if you disconnect or htcondor crashes, you can continue where you left off.
33
+
34
+ Detailed documentation can be found on [ReadTheDocs](https://falconry.readthedocs.io/en/latest/index.html). You can also check `example.py` for an example of usage. Package has to be first installed using pip as described in section on [installation](#installation-using-pip).
35
+
36
+ ## Instalation using pip
37
+
38
+ Falconry can be installed using pip:
39
+
40
+ $ pip3 install falconry
41
+
42
+ ## Installation from source
43
+
44
+ To install falconry, simply call following in the repository directory:
45
+
46
+ $ pip3 install --user -e .
47
+
48
+ Then you can include the package in your project simply by adding:
49
+
50
+ import falconry
51
+
52
+ ### Installing python3 API for HTCondor
53
+
54
+ The package requires htcondor API to run. One can simply do:
55
+
56
+ $ python3 -m pip install --user -r requirements.txt
57
+
58
+ though it might be better to install in virtual environment.
@@ -0,0 +1,36 @@
1
+ # falconry
2
+
3
+ ![Python package](https://github.com/fnechans/falconry/workflows/Python%20package/badge.svg)
4
+ [![Documentation Status](https://readthedocs.org/projects/falconry/badge/?version=latest)](https://falconry.readthedocs.io/en/latest/?badge=latest)
5
+
6
+ ## Introduction
7
+
8
+ Falconry is lightweight python package to create and manage your [HTCondor](https://github.com/htcondor/) jobs.
9
+ It handles things like job submission, dependent jobs, and job status checking. It periodically saves progress,
10
+ so even if you disconnect or htcondor crashes, you can continue where you left off.
11
+
12
+ Detailed documentation can be found on [ReadTheDocs](https://falconry.readthedocs.io/en/latest/index.html). You can also check `example.py` for an example of usage. Package has to be first installed using pip as described in section on [installation](#installation-using-pip).
13
+
14
+ ## Instalation using pip
15
+
16
+ Falconry can be installed using pip:
17
+
18
+ $ pip3 install falconry
19
+
20
+ ## Installation from source
21
+
22
+ To install falconry, simply call following in the repository directory:
23
+
24
+ $ pip3 install --user -e .
25
+
26
+ Then you can include the package in your project simply by adding:
27
+
28
+ import falconry
29
+
30
+ ### Installing python3 API for HTCondor
31
+
32
+ The package requires htcondor API to run. One can simply do:
33
+
34
+ $ python3 -m pip install --user -r requirements.txt
35
+
36
+ though it might be better to install in virtual environment.
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # falconry documentation build configuration file, created by
5
+ # sphinx-quickstart on Wed Sep 23 13:48:31 2020.
6
+ #
7
+ # This file is execfile()d with the current directory set to its
8
+ # containing dir.
9
+ #
10
+ # Note that not all possible configuration values are present in this
11
+ # autogenerated file.
12
+ #
13
+ # All configuration values have a default; values that are commented out
14
+ # serve to show the default.
15
+
16
+ # If extensions (or modules to document with autodoc) are in another directory,
17
+ # add these directories to sys.path here. If the directory is relative to the
18
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
19
+ #
20
+ import sys
21
+ from os.path import abspath, dirname, join
22
+ sys.path.insert(0, abspath(join(dirname(__file__), '../src')))
23
+
24
+ autodoc_mock_imports = ['ijson', 'htcondor']
25
+
26
+
27
+ # -- General configuration ------------------------------------------------
28
+
29
+ # If your documentation needs a minimal Sphinx version, state it here.
30
+ #
31
+ # needs_sphinx = '1.0'
32
+
33
+ # Add any Sphinx extension module names here, as strings. They can be
34
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35
+ # ones.
36
+ extensions = [
37
+ "sphinx.ext.autodoc",
38
+ "sphinx.ext.napoleon",
39
+ "sphinx_rtd_theme",
40
+ ]
41
+
42
+ html_theme = "sphinx_rtd_theme"
43
+
44
+ # Add any paths that contain templates here, relative to this directory.
45
+ templates_path = ['_templates']
46
+
47
+ # The suffix(es) of source filenames.
48
+ # You can specify multiple suffix as a list of string:
49
+ #
50
+ # source_suffix = ['.rst', '.md']
51
+ source_suffix = '.rst'
52
+
53
+ # The master toctree document.
54
+ master_doc = 'index'
55
+
56
+ # General information about the project.
57
+ project = 'falconry'
58
+ copyright = '2020-2024, Filip Nechansky'
59
+ author = 'Filip Nechansky'
60
+
61
+ # The version info for the project you're documenting, acts as replacement for
62
+ # |version| and |release|, also used in various other places throughout the
63
+ # built documents.
64
+ #
65
+ # The short X.Y version.
66
+ version = '0.1.2'
67
+ # The full version, including alpha/beta/rc tags.
68
+ release = '0.1.2'
69
+
70
+ # The language for content autogenerated by Sphinx. Refer to documentation
71
+ # for a list of supported languages.
72
+ #
73
+ # This is also used if you do content translation via gettext catalogs.
74
+ # Usually you set "language" from the command line for these cases.
75
+ language = None
76
+
77
+ # List of patterns, relative to source directory, that match files and
78
+ # directories to ignore when looking for source files.
79
+ # This patterns also effect to html_static_path and html_extra_path
80
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
81
+
82
+ # The name of the Pygments (syntax highlighting) style to use.
83
+ pygments_style = 'sphinx'
84
+
85
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
86
+ todo_include_todos = False
87
+
88
+
89
+ # -- Options for HTML output ----------------------------------------------
90
+
91
+ # The theme to use for HTML and HTML Help pages. See the documentation for
92
+ # a list of builtin themes.
93
+ #
94
+ # html_theme = 'alabaster'
95
+
96
+ # Theme options are theme-specific and customize the look and feel of a theme
97
+ # further. For a list of options available for each theme, see the
98
+ # documentation.
99
+ #
100
+ # html_theme_options = {}
101
+
102
+ # Add any paths that contain custom static files (such as style sheets) here,
103
+ # relative to this directory. They are copied after the builtin static files,
104
+ # so a file named "default.css" will overwrite the builtin "default.css".
105
+ html_static_path = ['_static']
106
+
107
+ # Custom sidebar templates, must be a dictionary that maps document names
108
+ # to template names.
109
+ #
110
+ # This is required for the alabaster theme
111
+ # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
112
+ html_sidebars = {
113
+ '**': [
114
+ 'relations.html', # needs 'show_related': True theme option to display
115
+ 'searchbox.html',
116
+ ]
117
+ }
118
+
119
+
120
+ # -- Options for HTMLHelp output ------------------------------------------
121
+
122
+ # Output file base name for HTML help builder.
123
+ htmlhelp_basename = 'falconrydoc'
124
+
125
+
126
+ # -- Options for LaTeX output ---------------------------------------------
127
+
128
+ latex_elements = {
129
+ # The paper size ('letterpaper' or 'a4paper').
130
+ #
131
+ # 'papersize': 'letterpaper',
132
+
133
+ # The font size ('10pt', '11pt' or '12pt').
134
+ #
135
+ # 'pointsize': '10pt',
136
+
137
+ # Additional stuff for the LaTeX preamble.
138
+ #
139
+ # 'preamble': '',
140
+
141
+ # Latex figure (float) alignment
142
+ #
143
+ # 'figure_align': 'htbp',
144
+ }
145
+
146
+ # Grouping the document tree into LaTeX files. List of tuples
147
+ # (source start file, target name, title,
148
+ # author, documentclass [howto, manual, or own class]).
149
+ latex_documents = [
150
+ (master_doc, 'falconry.tex', 'falconry Documentation',
151
+ 'Filip Nechansky', 'manual'),
152
+ ]
153
+
154
+
155
+ # -- Options for manual page output ---------------------------------------
156
+
157
+ # One entry per manual page. List of tuples
158
+ # (source start file, name, description, authors, manual section).
159
+ man_pages = [
160
+ (master_doc, 'falconry', 'falconry Documentation',
161
+ [author], 1)
162
+ ]
163
+
164
+
165
+ # -- Options for Texinfo output -------------------------------------------
166
+
167
+ # Grouping the document tree into Texinfo files. List of tuples
168
+ # (source start file, target name, title, author,
169
+ # dir menu entry, description, category)
170
+ texinfo_documents = [
171
+ (master_doc, 'falconry', 'falconry Documentation',
172
+ author, 'falconry', 'One line description of project.',
173
+ 'Miscellaneous'),
174
+ ]
@@ -0,0 +1,22 @@
1
+ .. falconry documentation master file, created by
2
+ sphinx-quickstart on Wed Sep 23 13:48:31 2020.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ Welcome to falconry's documentation!
7
+ ====================================
8
+
9
+ HTCondor is powerful tool for managment of jobs on computation clusters. It, and especially its python API, can be a bit complicated to use for an usual user.
10
+
11
+ The goal of falconry is to have a lightweight wrapper around the HTCondor python API to run jobs. In addition, it offers a manager, which automatically submits and controls jobs, and is able to handle dependent jobs. This way one can submit large number of inter-connected jobs without having to manually run or check anything.
12
+
13
+ Falconry is running on python 3 and can be found on `GitHub <https://github.com/fnechans/falconry>`_.
14
+
15
+ .. toctree::
16
+ :maxdepth: 2
17
+ :caption: Contents:
18
+
19
+ usage/install
20
+ usage/quickstart
21
+ usage/job
22
+ usage/manager
@@ -0,0 +1 @@
1
+ sphinx_rtd_theme
@@ -0,0 +1,18 @@
1
+ ============
2
+ Installation
3
+ ============
4
+
5
+ The package requires htcondor API to run. However, the dependency cannot be linked directly because the condor version depends on the version of htcondor your cluster uses.
6
+
7
+ To install the python API for condor using pip: ::
8
+
9
+ $ python3 -m pip install --user requirements.txt
10
+
11
+ To install falconry, simply call following in the repository directory: ::
12
+
13
+ $ python3 -m pip install --user -e .
14
+
15
+ Then you can include the package in your project simply by adding: ::
16
+
17
+ import falconry
18
+
@@ -0,0 +1,8 @@
1
+ .. _job:
2
+
3
+ ===
4
+ Job
5
+ ===
6
+
7
+ .. autoclass:: falconry.job
8
+ :members:
@@ -0,0 +1,8 @@
1
+ .. _manager:
2
+
3
+ =======
4
+ Manager
5
+ =======
6
+
7
+ .. autoclass:: falconry.manager
8
+ :members:
@@ -0,0 +1,84 @@
1
+ ==========
2
+ Quickstart
3
+ ==========
4
+
5
+ ---
6
+ Job
7
+ ---
8
+
9
+ Basic unit of the falconry is a job, which simply mantains all properties and submition. It can be imported simply as::
10
+
11
+ from falconry import job
12
+
13
+ Jobs require an HTCondor schedd. There is more convenient way to acquire it in the ``manager`` class mentioned later on, for now let's set it up directly::
14
+
15
+ from falconry import ScheddWrapper
16
+ schedd = ScheddWrapper()
17
+
18
+ which should automatically pick-up the local schedd. The job definition then needs a name - useful for identification with a larger number of jobs - and the schedd::
19
+
20
+ j = job(name, schedd)
21
+
22
+ There are several ways to initialize the job properties, but for a simple job, one can use a predefined function ``simple_job``::
23
+
24
+ j.set_simple(executablaPath, logFilesPath)
25
+
26
+ which only requires path to the executable and path to a dir where the log files will be saves. Both path can be relative wrt. to the directory where the python script is run.
27
+
28
+ One can setup the expected run time with ``set_time(runtime)`` defined in seconds::
29
+
30
+ j.set_time(3600)
31
+
32
+ Generally, one can add or overwrite any options to the job using ``set_custom(options)`` function where options are simply dictionary::
33
+
34
+ j.set_custom({"arguments": " --out X"})
35
+
36
+ And then to submit the job simply::
37
+
38
+ j.submit()
39
+
40
+ More details on job setup can be found in the :ref:`job` module documentation.
41
+
42
+ -------
43
+ Manager
44
+ -------
45
+
46
+ When launching large number of jobs, especially with some dependencies between them, it is convenient to use manager class. It handles all the jobs, queues and automatically submits those which are ready.
47
+
48
+ The manager can be imported as::
49
+
50
+ from falconry import manager
51
+ mgr = manager(dir)
52
+
53
+ It automatically finds local schedd, so jobs can be then initialized as::
54
+
55
+ from falconry import job
56
+ j = job(name, mgr.schedd)
57
+
58
+ without need to import HTCondor. To add a job to the manager simply do::
59
+
60
+ mgr.add_job(j)
61
+
62
+ If you want job to start after certain other jobs finish (dependency), add them first to the job::
63
+
64
+ j.add_dependency(j1, j2, j3)
65
+
66
+ The manager will then start the job once all dependencies are succesfully finished. This means that jobs without dependencies are submitted automatically, no need to call ``job.submit()``
67
+
68
+ Now, start the manager with following command::
69
+
70
+ mgr.start(checkTime)
71
+
72
+ where the ``checkTime`` specifies time in seconds in between checks of job status. After each interval, it will print status of each jobs and submit those waiting in queue if dependencies are satisfied.
73
+
74
+ However, user may want to interupt the programm, or there may be a crash. For that reason falconry periodically saves all managed jobs in a data.json file via ``save()`` function of the manager. To load previous instance of the manager then simply call::
75
+
76
+ mgr.load()
77
+
78
+ More details on manager setup can be found in the :ref:`manager` module documentation.
79
+
80
+ ---------------
81
+ Example program
82
+ ---------------
83
+
84
+ An example of a complete implemenation can be found in `example.py <https://github.com/fnechans/falconry/blob/master/example.py>`_, which puts all these features together. It also uses command line parser to make the usage more convenient. E.g. it automatically loads previous instance if ``--cont`` command line argument is used.