Skip to content

Commit

Permalink
Job State & Docs (#2)
Browse files Browse the repository at this point in the history
* first pass on job state

* add docs
  • Loading branch information
JoshKarpel authored Jul 10, 2019
1 parent f663a58 commit 87275ae
Show file tree
Hide file tree
Showing 33 changed files with 1,318 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ matrix:
fast_finish: true

install:
- docker build -t jobs-test --file docker/Dockerfile --build-arg HTCONDOR_VERSION --build-arg PYTHON_VERSION=$TRAVIS_PYTHON_VERSION .
- docker build -t jobs-test --file tests/_inf/Dockerfile --build-arg HTCONDOR_VERSION --build-arg PYTHON_VERSION=$TRAVIS_PYTHON_VERSION .

script:
- docker run jobs-test tests/travis.sh
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd
93 changes: 93 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
API Reference
=============

.. py:currentmodule:: htcondor_jobs
Describing Jobs
---------------

.. autoclass:: SubmitDescription

.. automethod:: as_submit


Submitting Jobs
---------------

.. autofunction:: submit

.. autoclass:: Transaction

.. automethod:: submit


Querying, Acting on, and Editing Jobs
-------------------------------------

.. autoclass:: ConstraintHandle

.. automethod:: query

.. automethod:: remove
.. automethod:: hold
.. automethod:: release
.. automethod:: pause
.. automethod:: resume
.. automethod:: vacate

.. automethod:: edit

.. autoattribute:: constraint
.. automethod:: reduce

Cluster Handles
---------------

.. autoclass:: ClusterHandle

.. autoattribute:: state

.. automethod:: save
.. automethod:: load
.. automethod:: to_json
.. automethod:: from_json

.. autoclass:: ClusterState

.. automethod:: is_complete
.. automethod:: any_running
.. automethod:: any_in_queue
.. automethod:: any_held

Constraints
-----------

.. autoclass:: Constraint

.. automethod:: reduce


Combinators
+++++++++++

.. autoclass:: And

.. autoclass:: Or

.. autoclass:: Not



Comparisons
+++++++++++

.. autoclass:: Comparison

.. autoclass:: Operator

.. autoclass:: ComparisonConstraint

Shortcuts
+++++++++

.. autoclass:: InCluster
74 changes: 74 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = "htcondor-jobs"
copyright = "2019, CHTC"
author = "CHTC"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]


# -- Extension configuration -------------------------------------------------

autodoc_member_order = "bysource"
autoclass_content = "both"
autodoc_default_flags = ["undoc-members"]

napoleon_use_rtype = True

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"https://docs.python.org/": None,
"https://htcondor.readthedocs.io/en/latest/": None,
}
15 changes: 15 additions & 0 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FAQ
===

.. py:currentmodule:: htmap
.. _install:

How do I install ``htcondor-jobs``?
-----------------------------------

On Unix/Linux systems, running ``pip install htcondor-jobs`` from the command line should suffice.

* To get the latest development version of ``htcondor-jobs``, run ``pip install git+https://github.com/htcondor/htcondor-jobs.git`` instead.
* Run ``pip install git+https://github.com/htcondor/htcondor-jobs.git@<branch>`` to install a specific branch.
* You may need to append ``--user`` to the ``pip`` command if you do not have permission to install packages directly into the Python you are using.
25 changes: 25 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
htcondor-jobs
=============

.. py:currentmodule:: htcondor_jobs
:doc:`api`
Public API documentation.

:doc:`faq`
These questions are asked, sometimes frequently.

:doc:`version-history`
New features, bug fixes, and known issues by version.


.. toctree::
:maxdepth: 2
:hidden:

self
api
faq
version-history

9 changes: 9 additions & 0 deletions docs/source/version-history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Version History
===============

.. toctree::
:maxdepth: 1
:glob:
:reversed:

versions/*
16 changes: 16 additions & 0 deletions docs/source/versions/v0_1_0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
v0.1.0
======

New Features
------------

* Clusters of jobs can be described and submitted, returning a handle.
* Handles can be used to query, act on, or edit the jobs they are connected to.


Bug Fixes
---------


Known Issues
------------
2 changes: 1 addition & 1 deletion dr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ CONTAINER_TAG=jobs-tests

set -e
echo "Building htcondor-jobs testing container..."
docker build --quiet -t ${CONTAINER_TAG} --file docker/Dockerfile .
docker build --quiet -t ${CONTAINER_TAG} --file tests/_inf/Dockerfile .
docker run -it --rm ${CONTAINER_TAG} $@
9 changes: 5 additions & 4 deletions htcondor_jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ def version_info() -> _Tuple[int, int, int, str]:

from .constraints import (
Constraint,
ComparisonConstraint,
Operator,
Comparison,
BooleanConstraint,
true,
false,
And,
Or,
Not,
Operator,
Comparison,
ComparisonConstraint,
InCluster,
)
from .handles import Handle, ConstraintHandle, ClusterHandle
from .descriptions import SubmitDescription
from .submit import submit, Transaction
from .status import JobStatus
from .status import JobStatus, ClusterState
from . import exceptions
Loading

0 comments on commit 87275ae

Please sign in to comment.