Skip to content

Commit

Permalink
multiple changes:
Browse files Browse the repository at this point in the history
- set up pipestatmanager based on pipelinemanager init args
- add pipestat argument group
  • Loading branch information
stolarczyk committed Jan 15, 2021
1 parent ce6d2ef commit cde3791
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
14 changes: 12 additions & 2 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def __init__(
dirty=False, recover=False, new_start=False, force_follow=False,
cores=1, mem="1000M", config_file=None, output_parent=None,
overwrite_checkpoints=False, logger_kwargs=None,
pipestat_manager=None, **kwargs
pipestat_namespace=None, pipestat_record_id=None, pipestat_schema=None,
pipestat_results_file=None, pipestat_config=None, **kwargs
):

# Params defines the set of options that could be updated via
Expand Down Expand Up @@ -347,7 +348,16 @@ def __init__(
self.debug("No config file")
self.config = None

self._pipestat_manager = pipestat_manager
# pipesatat setup
potential_namespace = getattr(self, "sample_name", self.name)
self._pipestat_manager = PipestatManager(
namespace=pipestat_namespace or potential_namespace,
record_identifier=pipestat_record_id or potential_namespace,
schema_path=pipestat_schema,
results_file_path=pipestat_results_file or pipeline_filepath(
self, filename="pipestat_results.yaml"),
config=pipestat_config
)

@property
def pipestat(self):
Expand Down
20 changes: 18 additions & 2 deletions pypiper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,10 @@ def _determine_args(argument_groups, arguments, use_all_args=False):
"looper": ["config", "output-parent", "mem", "cores"],
"common": ["input", "sample-name"],
"ngs": ["sample-name", "input", "input2", "genome", "single-or-paired"],
"logmuse": LOGGING_CLI_OPTDATA.keys()
"logmuse": LOGGING_CLI_OPTDATA.keys(),
"pipestat": ["pipestat-namespace", "pipestat-record-id",
"pipestat-schema", "pipestat-results-file",
"pipestat-config"]
}

# Handle various types of group specifications.
Expand Down Expand Up @@ -936,7 +939,20 @@ def _add_args(parser, args, required):
"help": "Identifier for genome assembly"}),
"single-or-paired":
("-Q", {"default": "single",
"help": "Single- or paired-end sequencing protocol"})
"help": "Single- or paired-end sequencing protocol"}),
"pipestat-namespace":
{"help": "Namespace to report into. This will be the DB table name "
"if using DB as the object back-end"},
"pipestat-record-id":
{"help": "Record identifier to report for"},
"pipestat-schema":
{"help": "Path to the output schema that formalizes the "
"results structure"},
"pipestat-config":
{"help": "Path to the configuration file"},
"pipestat-results-file":
{"help": "YAML file to report into, if file is used as "
"the object back-end"}
}

from logmuse import LOGGING_CLI_OPTDATA
Expand Down

0 comments on commit cde3791

Please sign in to comment.