runem 0.1.1__tar.gz → 0.2.0__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.
- {runem-0.1.1 → runem-0.2.0}/HISTORY.md +77 -0
- {runem-0.1.1 → runem-0.2.0}/PKG-INFO +1 -1
- runem-0.2.0/runem/VERSION +1 -0
- {runem-0.1.1 → runem-0.2.0}/runem/cli/initialise_options.py +1 -1
- {runem-0.1.1 → runem-0.2.0}/runem/command_line.py +3 -1
- {runem-0.1.1 → runem-0.2.0}/runem/config.py +6 -1
- {runem-0.1.1 → runem-0.2.0}/runem/config_metadata.py +4 -10
- {runem-0.1.1 → runem-0.2.0}/runem/config_parse.py +5 -10
- {runem-0.1.1 → runem-0.2.0}/runem/files.py +1 -1
- {runem-0.1.1 → runem-0.2.0}/runem/hook_manager.py +4 -9
- {runem-0.1.1 → runem-0.2.0}/runem/job.py +3 -1
- {runem-0.1.1 → runem-0.2.0}/runem/job_execute.py +26 -17
- {runem-0.1.1 → runem-0.2.0}/runem/job_filter.py +2 -8
- runem-0.2.0/runem/job_runner_simple_command.py +46 -0
- {runem-0.1.1 → runem-0.2.0}/runem/job_wrapper.py +2 -1
- {runem-0.1.1 → runem-0.2.0}/runem/job_wrapper_python.py +3 -1
- {runem-0.1.1 → runem-0.2.0}/runem/report.py +2 -3
- {runem-0.1.1 → runem-0.2.0}/runem/runem.py +5 -8
- runem-0.2.0/runem/types/__init__.py +12 -0
- runem-0.2.0/runem/types/common.py +12 -0
- runem-0.2.0/runem/types/errors.py +4 -0
- runem-0.2.0/runem/types/filters.py +12 -0
- runem-0.2.0/runem/types/hooks.py +15 -0
- runem-0.2.0/runem/types/options.py +7 -0
- runem-0.2.0/runem/types/runem_config.py +164 -0
- runem-0.2.0/runem/types/types_jobs.py +156 -0
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/PKG-INFO +1 -1
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/SOURCES.txt +11 -2
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/top_level.txt +1 -0
- {runem-0.1.1 → runem-0.2.0}/tests/cli/test_initialise_options.py +1 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_config.py +1 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_config_parse.py +4 -7
- {runem-0.1.1 → runem-0.2.0}/tests/test_files.py +1 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_hook_manager.py +2 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_job.py +3 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_job_execute.py +2 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_job_filter.py +2 -1
- runem-0.2.0/tests/test_job_runner_simple_command.py +99 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_job_wrapper.py +2 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_job_wrapper_python.py +3 -1
- {runem-0.1.1 → runem-0.2.0}/tests/test_report.py +2 -2
- {runem-0.1.1 → runem-0.2.0}/tests/test_runem.py +6 -7
- runem-0.2.0/tests/test_types/__init__.py +0 -0
- runem-0.2.0/tests/test_types/test_public_api.py +3 -0
- runem-0.1.1/runem/VERSION +0 -1
- runem-0.1.1/runem/job_runner_simple_command.py +0 -32
- runem-0.1.1/runem/types.py +0 -357
- runem-0.1.1/tests/test_job_runner_simple_command.py +0 -39
- {runem-0.1.1 → runem-0.2.0}/Containerfile +0 -0
- {runem-0.1.1 → runem-0.2.0}/LICENSE +0 -0
- {runem-0.1.1 → runem-0.2.0}/MANIFEST.in +0 -0
- {runem-0.1.1 → runem-0.2.0}/README.md +0 -0
- {runem-0.1.1 → runem-0.2.0}/requirements-test.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/requirements.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/__init__.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/__main__.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/base.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/blocking_print.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/cli.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/informative_dict.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/log.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/py.typed +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/run_command.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/runem_version.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem/utils.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/dependency_links.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/entry_points.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/runem.egg-info/requires.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/setup.cfg +0 -0
- {runem-0.1.1 → runem-0.2.0}/setup.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/__init__.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/conftest.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/data/help_output.3.10.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/data/help_output.3.11.txt +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/intentional_test_error.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/sanitise_reports_footer.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_base.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_blocking_print.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_cli.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_informative_dict.py +0 -0
- {runem-0.1.1 → runem-0.2.0}/tests/test_run_command.py +0 -0
@@ -4,6 +4,83 @@ Changelog
|
|
4
4
|
|
5
5
|
(unreleased)
|
6
6
|
------------
|
7
|
+
- Merge pull request #63 from
|
8
|
+
lursight/dependabot/github_actions/actions/cache-4. [Frank Harrison]
|
9
|
+
|
10
|
+
chore(deps): bump actions/cache from 3 to 4
|
11
|
+
- Chore(deps): bump actions/cache from 3 to 4. [dependabot[bot]]
|
12
|
+
|
13
|
+
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
|
14
|
+
- [Release notes](https://github.com/actions/cache/releases)
|
15
|
+
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
|
16
|
+
- [Commits](https://github.com/actions/cache/compare/v3...v4)
|
17
|
+
|
18
|
+
---
|
19
|
+
updated-dependencies:
|
20
|
+
- dependency-name: actions/cache
|
21
|
+
dependency-type: direct:production
|
22
|
+
update-type: version-update:semver-major
|
23
|
+
...
|
24
|
+
- Feat(simple-files): adds ability to pass file-lists to simple-
|
25
|
+
commands. [Frank Harrison]
|
26
|
+
- Feat(simple-files): strongly types the simple job executor. [Frank
|
27
|
+
Harrison]
|
28
|
+
- Feat(simple-files): fixes docstring. [Frank Harrison]
|
29
|
+
|
30
|
+
|
31
|
+
0.1.2 (2024-11-18)
|
32
|
+
------------------
|
33
|
+
- Release: version 0.1.2 🚀 [Frank Harrison]
|
34
|
+
- Chore(actions): simplifies code paths for actions. [Frank Harrison]
|
35
|
+
- Chore(contrib): removes the Makefile commands that have been removed.
|
36
|
+
[Frank Harrison]
|
37
|
+
|
38
|
+
.. this should have been in the last PR.
|
39
|
+
- Chore(contrib): update the CONTRIBUTING docs and removes defunct
|
40
|
+
scripts from Makefile. [Frank Harrison]
|
41
|
+
- Chore(faster-actions): removes redundant github actions. [Frank
|
42
|
+
Harrison]
|
43
|
+
|
44
|
+
This should speed up github actions, but it may lead to more false-positives as we are relying on runem to be working and realiabel to run our own checks....
|
45
|
+
|
46
|
+
This could come back to bite us.
|
47
|
+
- Chore(extra-ctx): adds config_metadata to job kw-args. [Frank
|
48
|
+
Harrison]
|
49
|
+
|
50
|
+
This allows much greater depth of testing based on other jobs-inclusion and metadata.
|
51
|
+
- Chore(extra-ctx): moves the job-task calling to use kwargs explicitly.
|
52
|
+
[Frank Harrison]
|
53
|
+
- Chore(extra-ctx): sort kwargs passed to jobs. [Frank Harrison]
|
54
|
+
- Merge pull request #59 from lursight/chore/cleaner_type_exports.
|
55
|
+
[Frank Harrison]
|
56
|
+
|
57
|
+
Chore/cleaner type exports
|
58
|
+
- Chore(clean-types): fixes false-negative from 'isort --check' [Frank
|
59
|
+
Harrison]
|
60
|
+
- Chore(clean-types): makes the public_api the actual exported api of
|
61
|
+
the types module. [Frank Harrison]
|
62
|
+
|
63
|
+
I think this could be better
|
64
|
+
- Chore(clean-types): renames type_wip -> types. [Frank Harrison]
|
65
|
+
- Chore(clean-types): fixes up more of the test-hooks (badly named) for
|
66
|
+
runem itself. [Frank Harrison]
|
67
|
+
- Chore(clean-types): splits out the rest of the types. [Frank Harrison]
|
68
|
+
- Chore(clean-types): moves config and serialisationtypes to own file.
|
69
|
+
[Frank Harrison]
|
70
|
+
- Chore(clean-types): moves error into new errors.py types file. [Frank
|
71
|
+
Harrison]
|
72
|
+
- Chore(clean-types): starts moving some types into 'common' [Frank
|
73
|
+
Harrison]
|
74
|
+
- Chore(clean-types): moves the types into types/wip whilst I work out
|
75
|
+
the public API. [Frank Harrison]
|
76
|
+
- Chore(clean-types): splits out the job and hook execution types, ahead
|
77
|
+
of building a better public api for type exports. [Frank Harrison]
|
78
|
+
- Chore(clean-types): sorts the job kwargs. [Frank Harrison]
|
79
|
+
|
80
|
+
|
81
|
+
0.1.1 (2024-11-17)
|
82
|
+
------------------
|
83
|
+
- Release: version 0.1.1 🚀 [Frank Harrison]
|
7
84
|
- Merge pull request #58 from lursight/fix/completed_job_counts. [Frank
|
8
85
|
Harrison]
|
9
86
|
|
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -8,7 +8,9 @@ from runem.config_metadata import ConfigMetadata
|
|
8
8
|
from runem.informative_dict import InformativeDict
|
9
9
|
from runem.log import error, log
|
10
10
|
from runem.runem_version import get_runem_version
|
11
|
-
from runem.types import JobNames
|
11
|
+
from runem.types.common import JobNames
|
12
|
+
from runem.types.options import OptionsWritable
|
13
|
+
from runem.types.runem_config import OptionConfig
|
12
14
|
from runem.utils import printable_set
|
13
15
|
|
14
16
|
|
@@ -7,7 +7,12 @@ from packaging.version import Version
|
|
7
7
|
|
8
8
|
from runem.log import error, log
|
9
9
|
from runem.runem_version import get_runem_version
|
10
|
-
from runem.types import
|
10
|
+
from runem.types.runem_config import (
|
11
|
+
Config,
|
12
|
+
GlobalConfig,
|
13
|
+
GlobalSerialisedConfig,
|
14
|
+
UserConfigMetadata,
|
15
|
+
)
|
11
16
|
|
12
17
|
CFG_FILE_YAML = pathlib.Path(".runem.yml")
|
13
18
|
|
@@ -3,16 +3,10 @@ import pathlib
|
|
3
3
|
import typing
|
4
4
|
|
5
5
|
from runem.informative_dict import InformativeDict
|
6
|
-
from runem.types import
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
OptionConfigs,
|
11
|
-
OptionsWritable,
|
12
|
-
OrderedPhases,
|
13
|
-
PhaseGroupedJobs,
|
14
|
-
TagFileFilters,
|
15
|
-
)
|
6
|
+
from runem.types.common import JobNames, JobPhases, JobTags, OrderedPhases
|
7
|
+
from runem.types.filters import TagFileFilters
|
8
|
+
from runem.types.options import OptionsWritable
|
9
|
+
from runem.types.runem_config import OptionConfigs, PhaseGroupedJobs
|
16
10
|
|
17
11
|
if typing.TYPE_CHECKING: # pragma: no cover
|
18
12
|
from runem.hook_manager import HookManager
|
@@ -10,28 +10,23 @@ from runem.hook_manager import HookManager
|
|
10
10
|
from runem.job import Job
|
11
11
|
from runem.job_wrapper import get_job_wrapper
|
12
12
|
from runem.log import error, log, warn
|
13
|
-
from runem.types import
|
13
|
+
from runem.types.common import JobNames, JobPhases, JobTags, OrderedPhases, PhaseName
|
14
|
+
from runem.types.errors import FunctionNotFound
|
15
|
+
from runem.types.filters import TagFileFilter, TagFileFilters
|
16
|
+
from runem.types.hooks import HookName
|
17
|
+
from runem.types.runem_config import (
|
14
18
|
Config,
|
15
19
|
ConfigNodes,
|
16
|
-
FunctionNotFound,
|
17
20
|
GlobalConfig,
|
18
21
|
GlobalSerialisedConfig,
|
19
22
|
HookConfig,
|
20
|
-
HookName,
|
21
23
|
Hooks,
|
22
24
|
HookSerialisedConfig,
|
23
25
|
JobConfig,
|
24
|
-
JobNames,
|
25
|
-
JobPhases,
|
26
26
|
JobSerialisedConfig,
|
27
|
-
JobTags,
|
28
27
|
JobWhen,
|
29
28
|
OptionConfigs,
|
30
|
-
OrderedPhases,
|
31
29
|
PhaseGroupedJobs,
|
32
|
-
PhaseName,
|
33
|
-
TagFileFilter,
|
34
|
-
TagFileFilters,
|
35
30
|
TagFileFilterSerialised,
|
36
31
|
)
|
37
32
|
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
5
5
|
from subprocess import check_output as subprocess_check_output
|
6
6
|
|
7
7
|
from runem.config_metadata import ConfigMetadata
|
8
|
-
from runem.types import FilePathListLookup
|
8
|
+
from runem.types.filters import FilePathListLookup
|
9
9
|
|
10
10
|
|
11
11
|
def find_files(config_metadata: ConfigMetadata) -> FilePathListLookup:
|
@@ -7,15 +7,10 @@ from runem.config_metadata import ConfigMetadata
|
|
7
7
|
from runem.job import Job
|
8
8
|
from runem.job_execute import job_execute
|
9
9
|
from runem.log import log
|
10
|
-
from runem.types import
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Hooks,
|
15
|
-
HookSpecificKwargs,
|
16
|
-
HooksStore,
|
17
|
-
JobConfig,
|
18
|
-
)
|
10
|
+
from runem.types.filters import FilePathListLookup
|
11
|
+
from runem.types.hooks import HookName
|
12
|
+
from runem.types.runem_config import HookConfig, Hooks, HooksStore, JobConfig
|
13
|
+
from runem.types.types_jobs import HookSpecificKwargs
|
19
14
|
|
20
15
|
|
21
16
|
class HookManager:
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import typing
|
2
2
|
|
3
|
-
from runem.types import FilePathList,
|
3
|
+
from runem.types.common import FilePathList, JobTags
|
4
|
+
from runem.types.filters import FilePathListLookup
|
5
|
+
from runem.types.runem_config import JobConfig, JobWhen
|
4
6
|
|
5
7
|
|
6
8
|
class NoJobName(ValueError):
|
@@ -12,14 +12,15 @@ from runem.informative_dict import ReadOnlyInformativeDict
|
|
12
12
|
from runem.job import Job
|
13
13
|
from runem.job_wrapper import get_job_wrapper
|
14
14
|
from runem.log import error, log
|
15
|
-
from runem.types import
|
16
|
-
|
17
|
-
|
15
|
+
from runem.types.common import FilePathList, JobTags
|
16
|
+
from runem.types.filters import FilePathListLookup
|
17
|
+
from runem.types.runem_config import JobConfig
|
18
|
+
from runem.types.types_jobs import (
|
19
|
+
AllKwargs,
|
18
20
|
HookSpecificKwargs,
|
19
|
-
JobConfig,
|
20
21
|
JobFunction,
|
22
|
+
JobKwargs,
|
21
23
|
JobReturn,
|
22
|
-
JobTags,
|
23
24
|
JobTiming,
|
24
25
|
TimingEntries,
|
25
26
|
TimingEntry,
|
@@ -80,19 +81,27 @@ def job_execute_inner(
|
|
80
81
|
log(f"job: running: '{Job.get_job_name(job_config)}'")
|
81
82
|
reports: JobReturn
|
82
83
|
try:
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
file_list
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
# Define the common args for all jobs and hooks.
|
85
|
+
job_k_args: JobKwargs = {
|
86
|
+
"config_metadata": config_metadata,
|
87
|
+
"file_list": file_list,
|
88
|
+
"job": job_config,
|
89
|
+
"label": Job.get_job_name(job_config),
|
90
|
+
"options": ReadOnlyInformativeDict(config_metadata.options),
|
91
|
+
"procs": config_metadata.args.procs,
|
92
|
+
"record_sub_job_time": _record_sub_job_time,
|
93
|
+
"root_path": root_path,
|
94
|
+
"verbose": config_metadata.args.verbose,
|
95
|
+
}
|
96
|
+
# Merge in the hook-specific kwargs (if any) for situations where we are
|
97
|
+
# calling hooks.
|
98
|
+
all_k_args: AllKwargs = {
|
99
|
+
**job_k_args,
|
94
100
|
**kwargs,
|
95
|
-
|
101
|
+
}
|
102
|
+
|
103
|
+
assert isinstance(function, JobFunction)
|
104
|
+
reports = function(**all_k_args)
|
96
105
|
except BaseException: # pylint: disable=broad-exception-caught
|
97
106
|
# log that we hit an error on this job and re-raise
|
98
107
|
log(decorate=False)
|
@@ -4,14 +4,8 @@ from collections import defaultdict
|
|
4
4
|
from runem.config_metadata import ConfigMetadata
|
5
5
|
from runem.job import Job
|
6
6
|
from runem.log import log
|
7
|
-
from runem.types import
|
8
|
-
|
9
|
-
JobNames,
|
10
|
-
JobPhases,
|
11
|
-
JobTags,
|
12
|
-
PhaseGroupedJobs,
|
13
|
-
PhaseName,
|
14
|
-
)
|
7
|
+
from runem.types.common import JobNames, JobPhases, JobTags, PhaseName
|
8
|
+
from runem.types.runem_config import JobConfig, PhaseGroupedJobs
|
15
9
|
from runem.utils import printable_set
|
16
10
|
|
17
11
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import shlex
|
2
|
+
import typing
|
3
|
+
|
4
|
+
from typing_extensions import Unpack
|
5
|
+
|
6
|
+
from runem.run_command import run_command
|
7
|
+
from runem.types.common import FilePathList
|
8
|
+
from runem.types.runem_config import JobConfig
|
9
|
+
from runem.types.types_jobs import AllKwargs
|
10
|
+
|
11
|
+
|
12
|
+
def validate_simple_command(command_string: str) -> typing.List[str]:
|
13
|
+
"""Use shlex to handle parsing of the command string, a non-trivial problem."""
|
14
|
+
split_command: typing.List[str] = shlex.split(command_string)
|
15
|
+
return split_command
|
16
|
+
|
17
|
+
|
18
|
+
def job_runner_simple_command(
|
19
|
+
**kwargs: Unpack[AllKwargs],
|
20
|
+
) -> None:
|
21
|
+
"""Parses the command and tries to run it via the system.
|
22
|
+
|
23
|
+
Commands inherit the environment.
|
24
|
+
"""
|
25
|
+
# assume we have the job.command entry, allowing KeyError to propagate up
|
26
|
+
job_config: JobConfig = kwargs["job"]
|
27
|
+
command_string: str = job_config["command"]
|
28
|
+
|
29
|
+
command_string_files: str = command_string
|
30
|
+
if "{file_list}" in command_string:
|
31
|
+
file_list: FilePathList = kwargs["file_list"]
|
32
|
+
file_list_with_quotes: typing.List[str] = [
|
33
|
+
f'"{str(file_path)}"' for file_path in file_list
|
34
|
+
]
|
35
|
+
command_string_files = command_string.replace(
|
36
|
+
"{file_list}", " ".join(file_list_with_quotes)
|
37
|
+
)
|
38
|
+
|
39
|
+
# use shlex to handle parsing of the command string, a non-trivial problem.
|
40
|
+
cmd = validate_simple_command(command_string_files)
|
41
|
+
|
42
|
+
# preserve quotes for consistent handling of strings and avoid the "word
|
43
|
+
# splitting" problem for unix-like shells.
|
44
|
+
cmd_with_quotes = [f'"{token}"' if " " in token else token for token in cmd]
|
45
|
+
|
46
|
+
run_command(cmd=cmd_with_quotes, **kwargs)
|
@@ -5,7 +5,8 @@ from runem.job_runner_simple_command import (
|
|
5
5
|
validate_simple_command,
|
6
6
|
)
|
7
7
|
from runem.job_wrapper_python import get_job_wrapper_py_func
|
8
|
-
from runem.types import
|
8
|
+
from runem.types.runem_config import JobWrapper
|
9
|
+
from runem.types.types_jobs import JobFunction
|
9
10
|
|
10
11
|
|
11
12
|
def get_job_wrapper(job_wrapper: JobWrapper, cfg_filepath: pathlib.Path) -> JobFunction:
|
@@ -3,7 +3,9 @@ import sys
|
|
3
3
|
from importlib.util import module_from_spec
|
4
4
|
from importlib.util import spec_from_file_location as module_spec_from_file_location
|
5
5
|
|
6
|
-
from runem.types import FunctionNotFound
|
6
|
+
from runem.types.errors import FunctionNotFound
|
7
|
+
from runem.types.runem_config import JobWrapper
|
8
|
+
from runem.types.types_jobs import JobFunction
|
7
9
|
|
8
10
|
|
9
11
|
def _load_python_function_from_module(
|
@@ -4,14 +4,13 @@ from collections import defaultdict
|
|
4
4
|
from datetime import timedelta
|
5
5
|
|
6
6
|
from runem.log import log
|
7
|
-
from runem.types import
|
7
|
+
from runem.types.common import OrderedPhases, PhaseName
|
8
|
+
from runem.types.types_jobs import (
|
8
9
|
JobReturn,
|
9
10
|
JobRunMetadatasByPhase,
|
10
11
|
JobRunReportByPhase,
|
11
12
|
JobRunTimesByPhase,
|
12
13
|
JobTiming,
|
13
|
-
OrderedPhases,
|
14
|
-
PhaseName,
|
15
14
|
ReportUrlInfo,
|
16
15
|
ReportUrls,
|
17
16
|
TimingEntries,
|
@@ -45,18 +45,15 @@ from runem.job_execute import job_execute
|
|
45
45
|
from runem.job_filter import filter_jobs
|
46
46
|
from runem.log import error, log, warn
|
47
47
|
from runem.report import report_on_run
|
48
|
-
from runem.types import
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
from runem.types.common import OrderedPhases, PhaseName
|
49
|
+
from runem.types.filters import FilePathListLookup
|
50
|
+
from runem.types.hooks import HookName
|
51
|
+
from runem.types.runem_config import Config, Jobs, PhaseGroupedJobs
|
52
|
+
from runem.types.types_jobs import (
|
52
53
|
JobReturn,
|
53
54
|
JobRunMetadata,
|
54
55
|
JobRunMetadatasByPhase,
|
55
|
-
Jobs,
|
56
56
|
JobTiming,
|
57
|
-
OrderedPhases,
|
58
|
-
PhaseGroupedJobs,
|
59
|
-
PhaseName,
|
60
57
|
)
|
61
58
|
from runem.utils import printable_set
|
62
59
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from runem.types.common import FilePathList, JobName
|
2
|
+
from runem.types.options import Options
|
3
|
+
from runem.types.types_jobs import HookKwargs, JobKwargs, JobReturnData
|
4
|
+
|
5
|
+
__all__ = [
|
6
|
+
"FilePathList",
|
7
|
+
"HookKwargs",
|
8
|
+
"JobName",
|
9
|
+
"JobReturnData",
|
10
|
+
"Options",
|
11
|
+
"JobKwargs",
|
12
|
+
]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import typing
|
2
|
+
|
3
|
+
# meta-data types
|
4
|
+
JobName = str
|
5
|
+
JobTag = str
|
6
|
+
JobNames = typing.Set[JobName]
|
7
|
+
JobPhases = typing.Set[str]
|
8
|
+
JobTags = typing.Set[JobTag]
|
9
|
+
PhaseName = str
|
10
|
+
OrderedPhases = typing.Tuple[PhaseName, ...]
|
11
|
+
FilePathSerialise = str
|
12
|
+
FilePathList = typing.List[FilePathSerialise]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import typing
|
2
|
+
|
3
|
+
from runem.types.common import FilePathList, JobTag
|
4
|
+
|
5
|
+
|
6
|
+
class TagFileFilter(typing.TypedDict):
|
7
|
+
tag: JobTag
|
8
|
+
regex: str
|
9
|
+
|
10
|
+
|
11
|
+
TagFileFilters = typing.Dict[JobTag, TagFileFilter]
|
12
|
+
FilePathListLookup = typing.DefaultDict[JobTag, FilePathList]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import enum
|
2
|
+
|
3
|
+
|
4
|
+
class HookName(enum.Enum):
|
5
|
+
"""List supported hooks.
|
6
|
+
|
7
|
+
TODO:
|
8
|
+
- before all tasks are run, after config is read
|
9
|
+
- BEFORE_ALL = "before-all"
|
10
|
+
- after all tasks are done, before reporting
|
11
|
+
- AFTER_ALL = "after-all"
|
12
|
+
"""
|
13
|
+
|
14
|
+
# at exit
|
15
|
+
ON_EXIT = "on-exit"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
from runem.informative_dict import InformativeDict, ReadOnlyInformativeDict
|
2
|
+
|
3
|
+
OptionName = str
|
4
|
+
OptionValue = bool
|
5
|
+
OptionsWritable = InformativeDict[OptionName, OptionValue]
|
6
|
+
OptionsReadOnly = ReadOnlyInformativeDict[OptionName, OptionValue]
|
7
|
+
Options = OptionsReadOnly
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import pathlib
|
2
|
+
import typing
|
3
|
+
|
4
|
+
from runem.types.common import JobName, JobTags, OrderedPhases, PhaseName
|
5
|
+
from runem.types.filters import TagFileFilter
|
6
|
+
from runem.types.hooks import HookName
|
7
|
+
|
8
|
+
|
9
|
+
class OptionConfig(typing.TypedDict, total=False):
|
10
|
+
"""Spec for configuring job option overrides."""
|
11
|
+
|
12
|
+
name: str
|
13
|
+
aliases: typing.Optional[typing.List[str]]
|
14
|
+
alias: typing.Optional[str]
|
15
|
+
default: bool
|
16
|
+
type: str
|
17
|
+
desc: typing.Optional[str]
|
18
|
+
|
19
|
+
|
20
|
+
OptionConfigs = typing.Tuple[OptionConfig, ...]
|
21
|
+
|
22
|
+
|
23
|
+
class OptionConfigSerialised(typing.TypedDict):
|
24
|
+
"""Supports better serialisation of options."""
|
25
|
+
|
26
|
+
option: OptionConfig
|
27
|
+
|
28
|
+
|
29
|
+
class JobParamConfig(typing.TypedDict):
|
30
|
+
"""Configures what parameters are passed to the test-callable.
|
31
|
+
|
32
|
+
FIXME: this isn't actually used at all, yet
|
33
|
+
"""
|
34
|
+
|
35
|
+
limitFilesToGroup: bool # whether to limit file-set for the job
|
36
|
+
|
37
|
+
|
38
|
+
class JobAddressConfig(typing.TypedDict):
|
39
|
+
"""Configuration which described a callable to call."""
|
40
|
+
|
41
|
+
file: str # the file-module where 'function' can be found
|
42
|
+
function: str # the 'function' in module to run
|
43
|
+
|
44
|
+
|
45
|
+
class JobContextConfig(typing.TypedDict, total=False):
|
46
|
+
# what parameters the job needs # DEFUNCT
|
47
|
+
params: typing.Optional[JobParamConfig]
|
48
|
+
|
49
|
+
# the path or paths to run the command in. If given a list the job will be
|
50
|
+
# duplicated for each given path.
|
51
|
+
cwd: typing.Optional[typing.Union[str, typing.List[str]]]
|
52
|
+
|
53
|
+
|
54
|
+
class JobWhen(typing.TypedDict, total=False):
|
55
|
+
"""Configures WHEN to call the callable i.e. priority."""
|
56
|
+
|
57
|
+
tags: JobTags # the job tags - used for filtering job-types
|
58
|
+
phase: PhaseName # the phase when the job should be run
|
59
|
+
|
60
|
+
|
61
|
+
class JobWrapper(typing.TypedDict, total=False):
|
62
|
+
"""A base-type for jobs, hooks, and things that can be invoked."""
|
63
|
+
|
64
|
+
addr: JobAddressConfig # which callable to call
|
65
|
+
command: str # a one-liner command to be run
|
66
|
+
|
67
|
+
|
68
|
+
class JobConfig(JobWrapper, total=False):
|
69
|
+
"""A dict that defines a job to be run.
|
70
|
+
|
71
|
+
It consists of the label, address, context and filter information
|
72
|
+
|
73
|
+
TODO: make a class variant of this
|
74
|
+
"""
|
75
|
+
|
76
|
+
label: JobName # the name of the job
|
77
|
+
ctx: typing.Optional[JobContextConfig] # how to call the callable
|
78
|
+
when: JobWhen # when to call the job
|
79
|
+
|
80
|
+
|
81
|
+
Jobs = typing.List[JobConfig]
|
82
|
+
|
83
|
+
|
84
|
+
class TagFileFilterSerialised(typing.TypedDict):
|
85
|
+
"""Supports better serialisation of TagFileFilters."""
|
86
|
+
|
87
|
+
filter: TagFileFilter
|
88
|
+
|
89
|
+
|
90
|
+
class GlobalConfig(typing.TypedDict):
|
91
|
+
"""The config for the entire test run."""
|
92
|
+
|
93
|
+
# Phases control the order of jobs, jobs earlier in the stack get run earlier
|
94
|
+
# the core ide here is to ensure that certain types of job-dependencies,
|
95
|
+
# such as code-reformatting jobs run before analysis tools, therefore making
|
96
|
+
# any error messages about the code give consistent line numbers e..g if a
|
97
|
+
# re-formatter edits a file the error line will move and the analysis phase
|
98
|
+
# will report the wrong line.
|
99
|
+
phases: OrderedPhases
|
100
|
+
|
101
|
+
# Options control the extra flags that are optionally consumed by job.
|
102
|
+
# Options configured here are used to set command-line-options. All options
|
103
|
+
# and their current state are passed to each job.
|
104
|
+
options: typing.Optional[typing.List[OptionConfigSerialised]]
|
105
|
+
|
106
|
+
# File filters control which files will be passed to jobs for a given tags.
|
107
|
+
# Job will receive the super-set of files for all that job's tags.
|
108
|
+
files: typing.Optional[typing.List[TagFileFilterSerialised]]
|
109
|
+
|
110
|
+
# Which minimal version of runem does this config support?
|
111
|
+
min_version: typing.Optional[str]
|
112
|
+
|
113
|
+
|
114
|
+
class GlobalSerialisedConfig(typing.TypedDict):
|
115
|
+
"""Intended to make reading a config file easier.
|
116
|
+
|
117
|
+
Unlike JobSerialisedConfig, this type may not actually help readability.
|
118
|
+
|
119
|
+
An intermediary type for serialisation of the global config, the 'global' resides
|
120
|
+
inside a 'global' key and therefore is easier to find and reason about.
|
121
|
+
"""
|
122
|
+
|
123
|
+
config: GlobalConfig
|
124
|
+
|
125
|
+
|
126
|
+
class HookConfig(JobWrapper, total=False):
|
127
|
+
"""Specification for hooks.
|
128
|
+
|
129
|
+
Like JobConfig with use addr or command to specify what to execute.
|
130
|
+
"""
|
131
|
+
|
132
|
+
hook_name: HookName # the hook for when this is called
|
133
|
+
|
134
|
+
|
135
|
+
class HookSerialisedConfig(typing.TypedDict):
|
136
|
+
"""Intended to make reading a config file easier.
|
137
|
+
|
138
|
+
Also, unlike JobSerialisedConfig, this type may not actually help readability.
|
139
|
+
"""
|
140
|
+
|
141
|
+
hook: HookConfig
|
142
|
+
|
143
|
+
|
144
|
+
class JobSerialisedConfig(typing.TypedDict):
|
145
|
+
"""Makes serialised configs easier to read.
|
146
|
+
|
147
|
+
An intermediary typ for serialisation as each 'job' resides inside a 'job' key.
|
148
|
+
|
149
|
+
This makes formatting of YAML config _significantly_ easier to understand.
|
150
|
+
"""
|
151
|
+
|
152
|
+
job: JobConfig
|
153
|
+
|
154
|
+
|
155
|
+
ConfigNodes = typing.Union[
|
156
|
+
GlobalSerialisedConfig, JobSerialisedConfig, HookSerialisedConfig
|
157
|
+
]
|
158
|
+
# The config format as it is serialised to/from disk
|
159
|
+
Config = typing.List[ConfigNodes]
|
160
|
+
UserConfigMetadata = typing.List[typing.Tuple[Config, pathlib.Path]]
|
161
|
+
Hooks = typing.DefaultDict[HookName, typing.List[HookConfig]]
|
162
|
+
# A dictionary to hold hooks, with hook names as keys
|
163
|
+
HooksStore = typing.Dict[HookName, typing.List[HookConfig]]
|
164
|
+
PhaseGroupedJobs = typing.DefaultDict[PhaseName, Jobs]
|