Skip to content

Commit

Permalink
Merge pull request #33 from NREL/pp/bg_log_fix
Browse files Browse the repository at this point in the history
Background logging fix
  • Loading branch information
ppinchuk authored Nov 6, 2023
2 parents 080f0fc + a17eda2 commit 9b1b6cc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
9 changes: 8 additions & 1 deletion examples/example_users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,14 @@ this:
If you prefer not to deal with background processes and would rather use a more integrated approach,
you can start the monitor as a detached process by using the ``--background`` option of the ``pipeline``
command. This will achieve the same effect as the `nohup` invocation described above, except without
command:

.. code-block::
shell
$ reV pipeline --background
This will achieve the same effect as the `nohup` invocation described above, except without
``stdout`` capture.

.. WARNING:: When running ``pipeline --background``, the spawned monitor process is detached,
Expand Down
27 changes: 16 additions & 11 deletions gaps/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,22 @@ def _warn_about_excessive_au_usage(self, num_jobs):

def run(self):
"""Run the entire config pipeline."""
return (
self.enable_logging()
.validate_config()
.log_job_info()
.preprocess_config()
.set_exec_kwargs()
.set_logging_options()
.set_exclude_from_status()
.prepare_context()
.kickoff_jobs()
)
try:
return (
self.enable_logging()
.validate_config()
.log_job_info()
.preprocess_config()
.set_exec_kwargs()
.set_logging_options()
.set_exclude_from_status()
.prepare_context()
.kickoff_jobs()
)
except Exception as e:
logger.error("Encountered error while kicking off jobs:")
logger.exception(e)
raise e


@click.pass_context
Expand Down
4 changes: 2 additions & 2 deletions gaps/cli/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def pipeline(
def _submit_recursive_pipelines(ctx, cancel, monitor, background):
"""Submit pipelines in all recursive subdirectories."""
start_dir = Path(".")
for ind, sub_dir in enumerate(start_dir.glob("**/")):
for sub_dir in start_dir.glob("**/"):
config_files = _find_pipeline_config_files(sub_dir)
if sub_dir.name == Status.HIDDEN_SUB_DIR:
continue
Expand All @@ -86,7 +86,7 @@ def _submit_recursive_pipelines(ctx, cancel, monitor, background):
if len(config_files) == 0:
continue

init_logging_from_config_file(config_files[0], background=ind == 0)
init_logging_from_config_file(config_files[0], background=background)
_run_pipeline(ctx, config_files[0], cancel, monitor, background)


Expand Down
2 changes: 1 addition & 1 deletion gaps/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""GAPs Version Number. """

__version__ = "0.6.2"
__version__ = "0.6.3"

0 comments on commit 9b1b6cc

Please sign in to comment.