nf-core / nf-core/tools

More consistent logging

Open
#1,534 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

command line tools low-priority
Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

Description of feature

There seems to be undesirable variation in how the nf_core/main.py script handles logging before the various sys.exit(1) codes. i.e. sometimes no logging, sometimes logging to log.error and sometimes to log.critical.

This is a list of except -> ... -> sys.exit(1) code snippets (sys.exit(1) is not shown for brevity):

240
    except LookupError as e:
        log.error(e)

320
    except UserWarning as e:
        log.error(e)

331
    except AssertionError as e:
        log.critical(e)

334
    except UserWarning as e:
        log.error(e)

361
    except LookupError as e:
        log.critical(e)

389
    except UserWarning as e:
        log.critical(e)

414
    except UserWarning as e:
        log.critical(e)

445
    except UserWarning as e:
        log.error(e)

494
    except UserWarning as e:
        log.error(e)

518
    except UserWarning as e:
        log.critical(e)

560
    except UserWarning as e:
        log.critical(e)

583
    except UserWarning as e:
        log.critical(e)

613
    except nf_core.modules.lint.ModuleLintException as e:
        log.error(e)

616
    except UserWarning as e:
        log.critical(e)

648
    except UserWarning as e:
        log.error(e)

668
    except nf_core.modules.module_utils.ModuleException as e:
        log.error(e)

671
    except UserWarning as e:
        log.critical(e)

727
    except UserWarning as e:
        log.critical(e)

745
    except AssertionError as e:
        log.error(e)

749
    except AssertionError as e:
        [no logging]

786
    except (UserWarning, AssertionError) as e:
        log.error(e)

813
    except AssertionError as e:
        [no logging]

849
    except AssertionError as e:
        log.error(e)

893
    except UserWarning as e:
        log.error(e)

934
    except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e:
        log.error(e)

There are also incidents of sys.exit(1) after an if statement. Also with seemingly inconsistent logging.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read nf_core/main.py at the listed exception handlers and sys.exit(1) branches, comparing the current log.error, log.critical, and no-logging cases. Determine a consistent logging policy with the maintainers, then update the affected branches so equivalent failures are handled consistently and every identified exit path follows the agreed policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.