Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to set a destination directory for the simulation output (local) #34

Merged
merged 31 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a5321da
Add an option to set a destination directory for the simulation output
Nov 1, 2023
e0a99ab
Tidy up function.
Nov 2, 2023
129ed15
reversed folder creation logic
JoschD Nov 2, 2023
26cbec2
fixing link to homepage
JoschD Nov 2, 2023
a290cc4
Merge branch 'master' into eos-output
JoschD Nov 7, 2023
4c12d9a
modified tests
JoschD Nov 7, 2023
72bc145
making tests run again
JoschD Nov 7, 2023
bf813f3
fixing mac?
JoschD Nov 7, 2023
9d7e6fa
added test for output_destination
JoschD Nov 7, 2023
df9ea34
cleanup imports
JoschD Nov 7, 2023
e6ca625
code cleanup
JoschD Nov 7, 2023
ac8f242
fixing imports
JoschD Nov 7, 2023
2d50155
more import fixes
JoschD Nov 7, 2023
a8db895
Lots of doc
JoschD Nov 8, 2023
b4c9ae2
bugfixes
JoschD Nov 8, 2023
bc6ff9c
uri-bugfixes
JoschD Nov 8, 2023
8b88de4
doc and version
JoschD Nov 8, 2023
796a477
missing package
JoschD Nov 8, 2023
c621b5f
gitignore
JoschD Nov 8, 2023
3f395ef
fixing macos
JoschD Nov 8, 2023
cc1c7b5
skip windows
JoschD Nov 8, 2023
a9dcc34
missing @
JoschD Nov 8, 2023
6e69eca
conf, changelog, additional doc for output_destination
JoschD Nov 10, 2023
147b3c6
extracting HTC constants
JoschD Nov 10, 2023
a697079
actually add constants file
JoschD Nov 10, 2023
ed7abbf
typehint for df_row
JoschD Nov 10, 2023
a46a6cb
test naming and test doc
JoschD Nov 10, 2023
ac4e6e9
even more doc in test
JoschD Nov 10, 2023
63c7c1f
fixing cyclic import
JoschD Nov 10, 2023
55e8205
fixes to CHANGELOG
JoschD Nov 10, 2023
b26a9db
added constants module to doc
JoschD Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ Temporary Items
# Neovim
.nvimlog

# Intellij
/.idea/codeStyles/codeStyleConfig.xml
/.idea/misc.xml
/.idea/modules.xml
/.idea/inspectionProfiles/profiles_settings.xml
/.idea/vcs.xml
/.idea/PyhDToolkit.iml

# Other
tst_*

4 changes: 2 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ html:
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

josch:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) /home/jdilly/Software/Documentation/submitter-doc
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) ../../Documentation/submitter-doc
@echo
@echo "Build finished. The HTML pages are in /home/jdilly/Software/Documentation/submitter-doc."
@echo "Build finished. The HTML pages are in ../../Documentation/submitter-doc."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand Down
91 changes: 91 additions & 0 deletions doc/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
:root {
--nav-side-width: 300px; /* default is 300px */
/* for 100% width */
/*--nav-content-width: 100%;*/
/*--local-toc-width: 300px;*/
/*--nav-content-width-wide: calc(100% - var(--local-toc-width)); /* 100% here is fullscreen */
/*--local-toc-left: calc(100% - var(--local-toc-width)); /* 100% here is w/o sidebar */

/* for fixed widths */
--nav-content-width: 800px; /* default is 800px */
--nav-content-width-wide: var(--nav-content-width);
--local-toc-width: calc(100% - var(--nav-content-width-wide));
--local-toc-left: calc(var(--nav-content-width-wide) + var(--nav-side-width));
}

/* main content width */
.wy-nav-content {
max-width: var(--nav-content-width);
}

/* Sidebar width */
.wy-nav-side {
width: var(--nav-side-width);
}

.wy-side-nav-search {
background: rgb(243,244,247);
}

.wy-side-nav-search > a {
color: black;
}

.wy-side-nav-search> a img.logo {
width: 50%;
}


.wy-side-nav-search > div.version {
color: black;
}
Expand Down Expand Up @@ -182,3 +216,60 @@ em.sig-param span.default_value {
.rst-content table.field-list th {
padding: 16px;
}


/* Create local table of contents
------------------------------
inspired by https://github.com/readthedocs/sphinx_rtd_theme/pull/919
and https://github.com/readthedocs/sphinx_rtd_theme/issues/764
see also _templates/layout.html
*/

#local-table-of-contents {
padding-bottom: 20px;
/* display: none; */
}

/* Mask entry of main header (chapter) */
#local-table-of-contents a[href="#"]{
/*display: none;*/
}

/* indent subsections */
#local-table-of-contents ul > ul {
padding-left: 0px;
margin-left: 20px;
padding-right: 0;
padding-bottom: 5px;
}


#local-table-of-contents-title {
margin-bottom: 10px;
}

/* Show in Sidebar if window width is larger than nav-side + nav-content + toc-width */
@media screen and (min-width: 1200px) {
.wy-nav-content {
max-width: var(--nav-content-width-wide);
}

#local-table-of-contents {
display: block;
position: fixed;
margin-left: 15px;
overflow-y: auto;
height: 95%;
top: 45px;
left: var(--local-toc-left);
width: var(--local-toc-width);
}

#local-table-of-contents-title {
display: block;
font-size: 16px;
width: 100%;
padding-top: 10px;
padding-bottom: 5px;
}
}
12 changes: 12 additions & 0 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "!layout.html" %}
{% block document %}
{%- if toc|length > title|length + 75 %}
<nav id="local-table-of-contents" role="navigation" aria-labelledby="local-table-of-contents-title">
<h4 id="local-table-of-contents-title">On This Page</h4>
{{ toc }}
</nav>
{%- endif %}

{{ super() }}
{% endblock %}

27 changes: 12 additions & 15 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,10 @@
sys.path.insert(0, str(TOPLEVEL_DIR))


def about_package(init_posixpath: pathlib.Path) -> dict:
"""
Return package information defined with dunders in __init__.py as a dictionary, when
provided with a PosixPath to the __init__.py file.
"""
about_text: str = init_posixpath.read_text()
return {
entry.split(" = ")[0]: entry.split(" = ")[1].strip('"')
for entry in about_text.strip().split("\n")
if entry.startswith("__")
}


ABOUT_PYLHC_SUBMITTER = about_package(ABOUT_FILE)
ABOUT_PYLHC_SUBMITTER: dict = {}
with ABOUT_FILE.open("r") as f:
exec(f.read(), ABOUT_PYLHC_SUBMITTER)
JoschD marked this conversation as resolved.
Show resolved Hide resolved


# -- General configuration ------------------------------------------------
Expand All @@ -66,9 +56,11 @@ def about_package(init_posixpath: pathlib.Path) -> dict:
"sphinx.ext.githubpages",
"sphinx.ext.napoleon",
]
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
Expand All @@ -84,6 +76,11 @@ def about_package(init_posixpath: pathlib.Path) -> dict:
copyright_ = "2019, pyLHC/OMC-TEAM"
author = ABOUT_PYLHC_SUBMITTER["__author__"]

# Override link in 'Edit on Github'
rst_prolog = f"""
:github_url: {ABOUT_PYLHC_SUBMITTER['__url__']}
"""

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
Expand All @@ -98,7 +95,7 @@ def about_package(init_posixpath: pathlib.Path) -> dict:
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
1 change: 1 addition & 0 deletions doc/entrypoints/autosix.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.. automodule:: pylhc_submitter.autosix
:members:
:noindex:
1 change: 1 addition & 0 deletions doc/entrypoints/job_submitter.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.. automodule:: pylhc_submitter.job_submitter
:members:
:noindex:
8 changes: 7 additions & 1 deletion doc/modules/constants.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
Constants Definitions
**************************
*********************


.. automodule:: pylhc_submitter.constants.general
:members:
:noindex:


.. automodule:: pylhc_submitter.constants.external_paths
:members:
:noindex:

.. automodule:: pylhc_submitter.constants.job_submitter
:members:
:noindex:

.. automodule:: pylhc_submitter.constants.autosix
:members:
:noindex:

9 changes: 0 additions & 9 deletions doc/modules/htc.rst

This file was deleted.

7 changes: 7 additions & 0 deletions doc/modules/sixdesk_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@ Sixdesk Tools

.. automodule:: pylhc_submitter.sixdesk_tools.stages
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.create_workspace
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.submit
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.post_process_da
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.extract_data_from_db
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.utils
:members:
:noindex:

.. automodule:: pylhc_submitter.sixdesk_tools.troubleshooting
:members:
:noindex:
19 changes: 19 additions & 0 deletions doc/modules/submitter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Submitter
*********

.. automodule:: pylhc_submitter.submitter.htc_utils
:members:
:noindex:


.. automodule:: pylhc_submitter.submitter.iotools
:members:
:noindex:

.. automodule:: pylhc_submitter.submitter.mask
:members:
:noindex:

.. automodule:: pylhc_submitter.submitter.runners
:members:
:noindex:
2 changes: 2 additions & 0 deletions doc/modules/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Utilities

.. automodule:: pylhc_submitter.utils.iotools
:members:
:noindex:


.. automodule:: pylhc_submitter.utils.logging_tools
:members:
:noindex:
2 changes: 1 addition & 1 deletion pylhc_submitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__title__ = "pylhc_submitter"
__description__ = "pylhc-submitter contains scripts to simplify the creation and submission of jobs to HTCondor at CERN"
__url__ = "https://github.com/pylhc/submitter"
__version__ = "1.1.1"
__version__ = "2.0.0"
__author__ = "pylhc"
__author_email__ = "[email protected]"
__license__ = "MIT"
Expand Down
35 changes: 9 additions & 26 deletions pylhc_submitter/autosix.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,34 +193,17 @@

import numpy as np
import tfs
from generic_parser import EntryPointParameters, entrypoint, DotDict
from generic_parser import EntryPointParameters, entrypoint
from generic_parser.entry_datatypes import DictAsString

from pylhc_submitter.constants.autosix import (
HEADER_BASEDIR,
SIXENV_REQUIRED,
SIXENV_OPTIONAL,
AutoSixEnvironment,
)
from pylhc_submitter.htc.mask import generate_jobdf_index
from pylhc_submitter.job_submitter import (
JOBSUMMARY_FILE,
COLUMN_JOBID,
)
from pylhc_submitter.sixdesk_tools.create_workspace import (
set_max_materialize
)
from pylhc_submitter.sixdesk_tools.stages import Stage, STAGE_ORDER
from pylhc_submitter.sixdesk_tools.utils import (
is_locked,
check_mask,
)
from pylhc_submitter.utils.iotools import (
PathOrStr,
save_config,
make_replace_entries_iterable,
keys_to_path
)
from pylhc_submitter.constants.autosix import (HEADER_BASEDIR, SIXENV_OPTIONAL, SIXENV_REQUIRED,
AutoSixEnvironment)
from pylhc_submitter.constants.job_submitter import COLUMN_JOBID, JOBSUMMARY_FILE
from pylhc_submitter.submitter.mask import generate_jobdf_index
from pylhc_submitter.sixdesk_tools.stages import STAGE_ORDER, Stage
from pylhc_submitter.sixdesk_tools.utils import check_mask, is_locked
from pylhc_submitter.utils.iotools import (PathOrStr, keys_to_path, make_replace_entries_iterable,
save_config)
from pylhc_submitter.utils.logging_tools import log_setup

LOG = logging.getLogger(__name__)
Expand Down
33 changes: 33 additions & 0 deletions pylhc_submitter/constants/job_submitter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

"""
Constants: Job Submitter
----------------------------------

Collections of constants and paths used in the job-submitter.
"""
from pylhc_submitter.constants.external_paths import MADX_BIN, PYTHON2_BIN, PYTHON3_BIN

JOBSUMMARY_FILE = "Jobs.tfs"
JOBDIRECTORY_PREFIX = "Job"
CONFIG_FILE = "config.ini"

SCRIPT_EXTENSIONS = {
"madx": ".madx",
"python3": ".py",
"python2": ".py",
}

EXECUTEABLEPATH = {
"madx": MADX_BIN,
"python3": PYTHON3_BIN,
"python2": PYTHON2_BIN,
}


COLUMN_JOBID = "JobId"
COLUMN_SHELL_SCRIPT = "ShellScript"
COLUMN_JOB_DIRECTORY = "JobDirectory"
COLUMN_DEST_DIRECTORY = "DestDirectory"
COLUMN_JOB_FILE = "JobFile"

NON_PARAMETER_COLUMNS = (COLUMN_SHELL_SCRIPT, COLUMN_JOB_DIRECTORY, COLUMN_JOB_FILE, COLUMN_DEST_DIRECTORY)
Loading