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

Implement a better config file system for CWL/WDL options #4666

Merged
merged 51 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0b3f120
Parse config file separately from rest of args
stxue1 Oct 10, 2023
fbb2ce2
Mypy
stxue1 Oct 10, 2023
bed1263
update configargparse stub
stxue1 Oct 10, 2023
970caa2
Dont try to eat cwl arguments
stxue1 Oct 11, 2023
6186a6c
Use simpler workaround
stxue1 Oct 11, 2023
8a450ca
Abstract out options for WDL, add WDL and CWL options to config file,…
stxue1 Oct 11, 2023
bd7a9a7
Create config files for WDL and CWL
stxue1 Oct 12, 2023
4b5158d
Add and fix config generation for CWL and WDL
stxue1 Oct 12, 2023
33cc57a
Fix typo
stxue1 Oct 13, 2023
dc3c0c1
Single config file with option detecting
stxue1 Oct 18, 2023
67888c5
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Oct 18, 2023
d83b81d
Add wdl/cwl options in addoptions
stxue1 Oct 19, 2023
7850139
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Oct 26, 2023
8ca8163
Move options around and generated config file is commented
stxue1 Oct 27, 2023
5cbc318
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Oct 30, 2023
f29b80f
Check for wrong runner options on command line
stxue1 Oct 30, 2023
ad35e7c
Fix recursive loop
stxue1 Nov 1, 2023
e023584
Apply DEFAULT_TMP_DIR to options.tmpdir instead of just local
stxue1 Nov 1, 2023
9e4d7e3
Update docs to new config file impl
stxue1 Nov 1, 2023
d3daa8f
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Nov 1, 2023
4bc1b7f
Prevent common options from conflicting
stxue1 Nov 2, 2023
f873f57
Remove unnecessary comment
stxue1 Nov 2, 2023
cb7d904
Merge branch 'master' into issues/4632-good-config-wdl-cwl
stxue1 Nov 2, 2023
00bd642
Update docs/running/cliOptions.rst
stxue1 Nov 13, 2023
56b504a
Update docs/running/cliOptions.rst
stxue1 Nov 13, 2023
c6d4df9
Update docs/running/cliOptions.rst
stxue1 Nov 13, 2023
4c4f92d
Update src/toil/common.py
stxue1 Nov 13, 2023
18e8e14
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Nov 13, 2023
423ccfd
Separate out options and consolidate duplicate code
stxue1 Nov 13, 2023
eecb190
Merge remote-tracking branch 'upstream/master' into issues/4632-good-…
adamnovak Nov 15, 2023
9b265cb
remove no longer necessary type ignore statements
stxue1 Nov 15, 2023
3ab06c4
Merge branch 'issues/4632-good-config-wdl-cwl' of github.com:DataBios…
stxue1 Nov 15, 2023
bbaa068
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Nov 16, 2023
a50d368
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Nov 16, 2023
a9042b5
Fix --help output being too early
stxue1 Nov 17, 2023
4a42b41
deal with mypy
stxue1 Nov 17, 2023
a54cfbf
Merge branch 'master' into issues/4632-good-config-wdl-cwl
adamnovak Nov 21, 2023
0bf6c25
Merge branch 'master' into issues/4632-good-config-wdl-cwl
adamnovak Nov 30, 2023
50ec040
Fix some argument help values/positions and add metavars to base options
stxue1 Dec 7, 2023
575aace
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Dec 7, 2023
937c782
Update comments in config file
stxue1 Dec 7, 2023
7190d3b
Merge branch 'issues/4632-good-config-wdl-cwl' of github.com:DataBios…
stxue1 Dec 7, 2023
440c841
Fix typo
stxue1 Dec 7, 2023
f673997
Add suppress functionality back
stxue1 Dec 7, 2023
373e418
Update src/toil/options/common.py
stxue1 Dec 7, 2023
499fb95
Merge branch 'master' into issues/4632-good-config-wdl-cwl
stxue1 Dec 7, 2023
255c714
Change original "bool" type to raw bool
stxue1 Dec 7, 2023
d6b99a4
Remove unused type ignore
stxue1 Dec 7, 2023
067bfdb
Merge branch 'issues/4632-good-config-wdl-cwl' of github.com:DataBios…
stxue1 Dec 7, 2023
1ea1938
Add back missing CWL argument --reference-inputs
stxue1 Dec 8, 2023
e783924
Merge branch 'master' into issues/4632-good-config-wdl-cwl
stxue1 Dec 12, 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
2 changes: 2 additions & 0 deletions contrib/mypy-stubs/configargparse/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .configargparse import ArgParser as ArgParser
from .configargparse import ArgumentParser as ArgumentParser
from .configargparse import Namespace as Namespace
from .configargparse import SUPPRESS as SUPPRESS
from .configargparse import YAMLConfigFileParser as YAMLConfigFileParser
8 changes: 7 additions & 1 deletion contrib/mypy-stubs/configargparse/configargparse.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import argparse
from typing import Any, OrderedDict, Sequence, TypeVar
from typing import Any, List, OrderedDict, Sequence, TypeVar

__all__ = ["ArgumentParser", "YAMLConfigFileParser", "ConfigFileParser"]
_N = TypeVar("_N")
Expand All @@ -19,10 +19,16 @@ class YAMLConfigFileParser(ConfigFileParser):
class ArgumentParser(argparse.ArgumentParser):
@property
def _config_file_parser(self) -> Any: ...
@property
def _default_config_files(self) -> List[Any]: ...
@property
def _ignore_unknown_config_file_keys(self) -> Any: ...

def __init__(self, *args: Any, **kwargs: Any) -> None: ...
# There may be a better way of type hinting this without a type: ignore, but mypy gets unhappy pretty much no matter what as the signatures for parse_args doesn't match with its superclass in argparse
def parse_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None, config_file_contents: str | None = None, env_vars: Any = None) -> Namespace: ... # type: ignore[override]
def get_source_to_settings_dict(self) -> OrderedDict[Any, Any]: ...

Namespace = argparse.Namespace
ArgParser = ArgumentParser
SUPPRESS = argparse.SUPPRESS
40 changes: 33 additions & 7 deletions docs/running/cliOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,45 @@ The Config File
Instead of changing the arguments on the CLI, Toil offers support for using a configuration file (Note: Support for the
configuration file and environmental variables require the use of ``configargparse``).

To generate a default configuration file::
Options will be applied with priority:

$ toil config [file].yaml
1. CLI

2. Environmental Variables

3. Config file values

a. Provided config file through CLI

b. Default config value in ``$HOME/.toil/default.yaml``

4. Defaults

To generate a configuration file, run::

$ toil config [filename].yaml

Then uncomment options as necessary and change/provide new values.

After editing the config file, make Toil take in the new options::

$ python example.py --config=[file].yaml
$ python example.py --config=[filename].yaml

Alternatively, you can edit the default config file, which is located at ``$HOME/.toil/default.yaml``

If CLI options are used in addition to the configuration file, the CLI options will overwrite the configuration file
options. For example::

$ python example.py --config=[filename].yaml --maxNodes 20

With configuration file::

...
maxNodes=[10]
...

If CLI options are used in addition with the configuration file, the CLI options will overwrite the configuration file
options::
Will result in maxNodes=[20].

$ python example.py --config=[file].yaml --maxNodes 20
# maxNodes=[20] even though default maxNodes=[10]

The Job Store
-------------
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ pytz>=2012
enlighten>=1.5.2, <2
configargparse>=1.7,<2
ruamel.yaml>=0.15
ruamel.yaml.string>=0.1.1
pyyaml>=6,<7
typing-extensions>=4.6.2, <5
3 changes: 2 additions & 1 deletion src/toil/batchSystems/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
from toil.batchSystems.cleanup_support import BatchSystemCleanupSupport
from toil.batchSystems.contained_executor import pack_job
from toil.batchSystems.options import OptionSetter
from toil.common import SYS_MAX_SIZE, Config, Toil
from toil.common import Config, Toil
from toil.options.common import SYS_MAX_SIZE
from toil.job import JobDescription, Requirer
from toil.lib.conversions import human2bytes
from toil.lib.misc import get_user_name, slow_down, utc_now
Expand Down
2 changes: 1 addition & 1 deletion src/toil/batchSystems/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def set_batchsystem_options(batch_system: Optional[str], set_option: OptionSette


def add_all_batchsystem_options(parser: Union[ArgumentParser, _ArgumentGroup]) -> None:
from toil.common import SYS_MAX_SIZE
from toil.options.common import SYS_MAX_SIZE

# Do the global cross-batch-system arguments
parser.add_argument(
Expand Down
3 changes: 2 additions & 1 deletion src/toil/batchSystems/singleMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
UpdatedBatchJobInfo)
from toil.batchSystems.options import OptionSetter
from toil.bus import ExternalBatchIdMessage
from toil.common import SYS_MAX_SIZE, Config, Toil, make_open_interval_action
from toil.common import Config, Toil
from toil.options.common import SYS_MAX_SIZE, make_open_interval_action
from toil.job import (AcceleratorRequirement,
JobDescription,
Requirer,
Expand Down
Loading