Example #1
0
def main():

    logger = set_logger(os.path.splitext(os.path.split(__file__)[-1])[0], 'INFO')
    """Print currently loaded suite definition"""
    try:
        ci = ecflow.Client()
        # Get server definition by syncing with client defs.
        ci.sync_local()
        # Set print style to show structure of suite definition.
        ecflow.PrintStyle.set_style(ecflow.Style.DEFS)
        # Print the returned suite definition.
        logger.info(ci.get_defs())
    except RuntimeError:
        msg = ('Error in {}\n'.format(__file__)+
              'ecflow was not able to retrieve suite definition')
        if sys.version_info[0] != 3:
           import traceback
           msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
        raise RuntimeError(msg)
    return
Example #2
0
def main():

    logger = set_logger(os.path.splitext(os.path.split(__file__)[-1])[0], "INFO")
    """Print currently loaded suite definition"""
    try:
        ci = ecflow.Client()
        # Get server definition by syncing with client defs.
        ci.sync_local()
        # Set print style to show structure of suite definition.
        ecflow.PrintStyle.set_style(ecflow.Style.DEFS)
        # Print the returned suite definition.
        logger.info(ci.get_defs())
    except RuntimeError:
        msg = "Error in {}\n".format(__file__) + "ecflow was not able to retrieve suite definition"
        if sys.version_info[0] != 3:
            import traceback

            msg += "\n\nOriginal traceback:\n" + traceback.format_exc()
        raise RuntimeError(msg)
    return
Example #3
0
def main():

    logger = set_logger(os.path.splitext(os.path.split(__file__)[-1])[0], 'INFO')

    """Print ECFLOW server state."""
    try:
        ci = ecflow.Client()
        # Get server definition by syncing with client defs.
        ci.sync_local()
        # Set print style to show state.
        ecflow.PrintStyle.set_style(ecflow.Style.STATE)
        # Print the returned state.
        logger.info(ci.get_defs())
    except RuntimeError:
        msg = ('Error in {}\n'.format(__file__)+
              'ecflow was not able to retrieve server state')
        if sys.version_info[0] != 3:
           import traceback
           msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
        raise RuntimeError(msg)
    return
Example #4
0
def main():
    """Start ECFLOW from HALTED server.

    Delete any currently loaded suite definitions and tasks. Load
    a new suite definition file. Restart the server. Run new suite. Run 
    this version when starting with a HALTED server. Run from inside
    def_files directory."""

    logger = set_logger(
        os.path.splitext(os.path.split(__file__)[-1])[0], 'INFO')

    if len(sys.argv) == 2:
        suite = sys.argv[1]
        def_file = suite + ".def"
    else:
        logger.critical('Usage: python {} suite_name'.format(__file__))
        sys.exit()

    try:
        logger.info('Loading definition in ' + def_file + ' into the server')
        ci = ecflow.Client()
        ci.delete_all()
        # Read definition from disk and load into the server.
        ci.load(def_file)

        logger.info('Restarting the server. This starts job scheduling')
        ci.restart_server()

        logger.info('Begin the suite named ' + suite)
        ci.begin_suite(suite)
    except RuntimeError:
        msg = ('Error in {}\n'.format(__file__) +
               'ecflow was not able to begin suite {}'.format(suite))
        if sys.version_info[0] != 3:
            import traceback
            msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
        raise RuntimeError(msg)
    return
Example #5
0
def main():
    """Start ECFLOW from HALTED server.

    Delete any currently loaded suite definitions and tasks. Load
    a new suite definition file. Restart the server. Run new suite. Run 
    this version when starting with a HALTED server. Run from inside
    def_files directory."""

    logger = set_logger(os.path.splitext(os.path.split(__file__)[-1])[0], 'INFO')
    
    if len(sys.argv) == 2:
        suite = sys.argv[1]
        def_file = suite + ".def"
    else:
        logger.critical('Usage: python {} suite_name'.format(__file__))
        sys.exit()

    try:
        logger.info('Loading definition in '+def_file+' into the server')
        ci = ecflow.Client()
        ci.delete_all()
        # Read definition from disk and load into the server.
        ci.load(def_file)

        logger.info('Restarting the server. This starts job scheduling')
        ci.restart_server()

        logger.info('Begin the suite named ' + suite)
        ci.begin_suite(suite)
    except RuntimeError:
        msg = ('Error in {}\n'.format(__file__)+
              'ecflow was not able to begin suite {}'.format(suite))
        if sys.version_info[0] != 3:
           import traceback
           msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
        raise RuntimeError(msg)
    return
Example #6
0
def main():
    """Replace definition file and run new suite.

    Delete any currently loaded definition files and tasks. Load the 
    suite definition file, and run the suite.
    Run this version to start when you are starting with a RUNNING server.
    Run from inside the def_files/ directory.
    """

    logger = set_logger(os.path.splitext(os.path.split(__file__)[-1])[0], 'INFO') 
    
    logger.info('Client -> Server: delete, then load a new definition')

    if len(sys.argv) == 2:
        suite = sys.argv[1]
        def_file = suite + '.def'
    else:
        logger.critical('Usage: python {} suite_name'.format(__file__))
        sys.exit()

    try:
        ci = ecflow.Client()
        # Clear out the server
        ci.delete_all()
        # Load the definition into the server.
        ci.load(def_file)
        # Start the suite.
        ci.begin_suite(suite)
    except RuntimeError:
        msg = ('Error in {}\n'.format(__file__)+
              'ecflow was not able to begin suite {}'.format(suite))
        if sys.version_info[0] != 3:
           import traceback
           msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
        raise RuntimeError(msg)
    return