How to use the ipython.logger.info function in ipython

To help you get started, we’ve selected a few ipython 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 pylada / pylada-light / ipython / launch / __init__.py View on Github external
try:
        mppalloc = shell.ev(event.nbprocs)
    except Exception as e:
        print(("Could not make sense of --nbprocs argument {0}.\n{1}"               \
              .format(event.nbprocs, e)))
        return
    logger.info("launch/init: mppalloc a: %s" % mppalloc)
    if mppalloc is None and withdefault:
        def mppalloc(job):
            """ Returns number of processes for this job. """
            natom = len(job.structure)  # number of atoms.
            # Round down to a multiple of ppn
            nnode = max(1, natom / event.ppn)
            nproc = nnode * event.ppn
            return nproc
    logger.info("launch/init: mppalloc b: %s" % mppalloc)
    return mppalloc
github pylada / pylada-light / ipython / launch / __init__.py View on Github external
def get_mppalloc(shell, event, withdefault=True):
    """ Gets mpp allocation. """
    from .. import logger

    logger.info("launch/init: shell: %s" % shell)
    logger.info("launch/init: event: %s" % event)
    logger.info("launch/init: event.ppn: %s" % event.ppn)
    logger.info("launch/init: withdefault: %s" % withdefault)
    try:
        mppalloc = shell.ev(event.nbprocs)
    except Exception as e:
        print(("Could not make sense of --nbprocs argument {0}.\n{1}"               \
              .format(event.nbprocs, e)))
        return
    logger.info("launch/init: mppalloc a: %s" % mppalloc)
    if mppalloc is None and withdefault:
        def mppalloc(job):
            """ Returns number of processes for this job. """
            natom = len(job.structure)  # number of atoms.
            # Round down to a multiple of ppn
            nnode = max(1, natom / event.ppn)
github pylada / pylada-light / ipython / launch / scattered.py View on Github external
from os.path import exists, basename
    from os import remove
    import pylada
    from .. import get_shell
    from ...misc import local_path, testValidProgram
    from ... import pbs_string, default_pbs, qsub_exe, default_comm
    from . import get_walltime, get_mppalloc, get_queues, scattered_script
    from .. import logger

    if not hasattr(pylada, 'ipython_qstat'):
        logger.warning("Missing ipython_qstat function: cannot check for jobs already in queue")
        qstat = lambda x: []
    else:
        qstat = lambda x: self.qstat(x)

    logger.info("launch/scattered: event: %s" % event)
    shell = get_shell(self)

    pbsargs = deepcopy(dict(default_comm))
    pbsargs.update(default_pbs)
    pbsargs['ppn'] = event.ppn

    mppalloc = get_mppalloc(shell, event)
    if mppalloc is None:
        return

    # Set pbsargs['walltime'] to a string like '03:59:59'
    if not get_walltime(shell, event, pbsargs):
        return

    # Set pbsargs['queue'], pbsargs['account']
    if not get_queues(shell, event, pbsargs):
github pylada / pylada-light / ipython / launch / scattered.py View on Github external
if testValidProgram != None \
                        and (re.match('^ *module ', line)
                             or re.match('^\. .*/bin/activate$', line)):
                        line = omitTag + line
                    file.write(line + '\n')
            assert exists(pbsscripts[-1])

        print(("Created {0} scattered jobs from {1}.".format(len(pbsscripts), path)))

    if event.nolaunch:
        return
    # otherwise, launch.
    for script in pbsscripts:
        logger.info("launch/scattered: launch: shell: %s" % shell)
        logger.info("launch/scattered: launch: qsub_exe: %s" % qsub_exe)
        logger.info("launch/scattered: launch: script: \"%s\"" % script)

        if testValidProgram != None:
            cmdLine = '/bin/bash ' + script
        else:
            # qsub pbsscript (template is in config/mpi.py: pbs_string),
            # which sets up modules and invokes: python {scriptcommand}
            cmdLine = "{0} {1}".format(qsub_exe, script)

        nmerr = script + '.stderr'
        nmout = script + '.stdout'
        with open(nmerr, 'w') as ferr:
            with open(nmout, 'w') as fout:
                subprocess.call(cmdLine, shell=True, stderr=ferr, stdout=fout)
                # xxx: all subprocess: set stderr, stdout
        if os.path.getsize(nmerr) != 0:
            with open(nmerr) as fin: