How to use the logmuse.logger_via_cli function in logmuse

To help you get started, we’ve selected a few logmuse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github databio / refgenie / refgenie / refgenie.py View on Github external
def main():
    """ Primary workflow """
    parser = logmuse.add_logging_options(build_argparser())
    args, remaining_args = parser.parse_known_args()
    global _LOGGER
    _LOGGER = logmuse.logger_via_cli(args, make_root=True)
    _LOGGER.debug("refgenie {}".format(__version__))
    _LOGGER.debug("Args: {}".format(args))

    if not args.command:
        parser.print_help()
        _LOGGER.error("No command given")
        sys.exit(1)

    gencfg = refgenconf.select_genome_config(filename=args.genome_config, check_exist=not args.command == INIT_CMD,
                                             on_missing=lambda fp: fp, strict_env=True)
    if gencfg is None:
        raise MissingGenomeConfigError(args.genome_config)
    _LOGGER.debug("Determined genome config: {}".format(gencfg))

    # From user input we want to construct a list of asset dicts, where each
    # asset has a genome name, asset name, and tag
github databio / pypiper / pypiper / manager.py View on Github external
# Set up logger
        logger_kwargs = logger_kwargs or {}
        default_logname = ".".join([__name__, self.__class__.__name__, self.name])
        if not args:
            # strict is only for logger_via_cli.
            kwds = {k: v for k, v in logger_kwargs.items() if k != "strict"}
            try:
                name = kwds.pop("name")
            except KeyError:
                name = default_logname
            self._logger = logmuse.init_logger(name, **kwds)
            self.debug("Logger set with logmuse.init_logger")
        else:
            logger_kwargs.setdefault("name", default_logname)
            try:
                self._logger = logmuse.logger_via_cli(args)
                self.debug("Logger set with logmuse.logger_via_cli")
            except logmuse.est.AbsentOptionException:
                self._logger = logmuse.init_logger("pypiper", level="DEBUG")
                self.debug("logger_via_cli failed; Logger set with logmuse.init_logger")

        # Keep track of an ID for the number of processes attempted
        self.proc_count = 0

        # We use this memory to pass a memory limit to processes like java that
        # can take a memory limit, so they don't get killed by a SLURM (or other
        # cluster manager) overage. However, with java, the -Xmx argument can only
        # limit the *heap* space, not total memory use; so occasionally SLURM will
        # still kill these processes because total memory goes over the limit.
        # As a kind of hack, we'll set the java processes heap limit to 95% of the
        # total memory limit provided.
        # This will give a little breathing room for non-heap java memory use.
github databio / pepatac / tools / bamSitesToWig.py View on Github external
default="",#os.getcwd(),
        help="Temporary file location. By default it will use the working"
        " directory, but you can place this elsewhere if you'd like."
        " The actual folder will be based on the exactbw filename.")
    parser.add_argument('--retain-temp', action='store_true', default=False,
        help="Retain temporary files? Default: False")

    parser = add_logging_options(parser)
    return parser.parse_args(cmdl)

if __name__ == "__main__":

    args = parse_args(sys.argv[1:])
    if not (args.exactbw or args.smoothbw):
        parser.error('No output requested, use --exactbw and/or --smoothbw')
    _LOGGER = logger_via_cli(args)

    if args.mode == "dnase":
        shift_factor = {"+":1, "-":0}  # DNase
    elif args.mode == "atac":
        shift_factor = {"+":4, "-":-5}  # ATAC
    else:
        shift_factor = {"+":0, "-":0}

    ct = CutTracer( reads_filename=args.infile,
                    chrom_sizes_file=args.chrom_sizes_file,
                    summary_filename=args.summary_file,
                    variable_step=args.variable_step,
                    exactbw=args.exactbw,
                    smoothbw=args.smoothbw,
                    step_size=args.step_size,
                    bedout=args.bedout,

logmuse

Logging setup

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages