How to use logmuse - 10 common examples

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 pepkit / peppy / peppy / cli.py View on Github external
def main():
    """ Primary workflow """
    parser = logmuse.add_logging_options(build_argparser())
    args, remaining_args = parser.parse_known_args()
    if not args.command:
        parser.print_help()
        _LOGGER.error("No command given")
        sys.exit(1)
    _LOGGER.debug("Creating a Project object from: {}".format(args.pep))
    p = Project(args.pep)
    if args.command == VALIDATE_CMD:
        if args.sample_name:
            try:
                args.sample_name = int(args.sample_name)
            except ValueError:
                pass
            _LOGGER.debug("Comparing Sample ('{}') in the Project "
                          "('{}') against a schema: {}.".
                          format(args.sample_name, args.pep, args.schema))
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))
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 / pepatac / tools / bamSitesToWig.py View on Github external
help="Output the 3' end of the sequence read. Default: False")
    parser.add_argument('-m', '--mode', dest='mode', default=None, choices=MODES,
        help="Turn on DNase or ATAC mode (this adjusts the shift parameters)")
    parser.add_argument('-t', '--limit', dest='limit',
        help="Limit to these chromosomes", nargs = "+", default=None)
    parser.add_argument('-p', '--cores', dest='cores',
        help="Number of cores to use", default=2, type=int)
    parser.add_argument('-e', '--temp-parent',
        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)
github databio / pypiper / pypiper / manager.py View on Github external
self.cores = params['cores']
        self.output_parent = params['output_parent']
        self.testmode = params['testmode']


        # 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
github databio / refgenie / refgenie / __init__.py View on Github external
from ._version import __version__
import logmuse
logmuse.init_logger("refgenie")
github databio / pypiper / pypiper / manager.py View on Github external
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.

        if not params['mem'].endswith(('K','M','G','T')):
            self.mem = params['mem'] + "M"
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,
github databio / pypiper / pypiper / manager.py View on Github external
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.

        if not params['mem'].endswith(('K','M','G','T')):

logmuse

Logging setup

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages