def readobject(directory=None):
    # load this here to prevent circular
    from paramgrid import gridconfig

    if directory is None:
        directory = sys.argv[1]
    fname = os.path.abspath(directory) + os.sep + 'batch.pyobj'
    if not os.path.exists(fname):
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory,
                                       readOnly=True,
                                       interactive=False)
        return None
    try:
        config_dir = os.path.abspath(directory) + os.sep + 'config'
        if os.path.exists(config_dir):
            # set path in case using functions defined and hene imported from in settings file
            sys.path.insert(0, config_dir)
        with open(fname, 'rb') as inp:
            return pickle.load(inp)
    except Exception as e:
        print('Error lading cached batch object: %s', e)
        resetGrid(directory)
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory,
                                       readOnly=True,
                                       interactive=False)
        raise
示例#2
0
def readobject(directory=None):
    # load this here to prevent circular
    from paramgrid import gridconfig

    if directory is None:
        directory = sys.argv[1]
    fname = os.path.abspath(directory) + os.sep + 'batch.pyobj'
    if not os.path.exists(fname):
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory, readOnly=True, interactive=False)
        return None
    try:
        with open(fname, 'rb') as inp:
            return pickle.load(inp)
    except:
        resetGrid(directory)
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory, readOnly=True, interactive=False)
        raise
示例#3
0
def readobject(directory=None):
    # load this here to prevent circular
    from paramgrid import gridconfig

    if directory is None:
        directory = sys.argv[1]
    fname = os.path.abspath(directory) + os.sep + 'batch.pyobj'
    if not os.path.exists(fname):
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory, readOnly=True, interactive=False)
        return None
    try:
        config_dir = os.path.abspath(directory) + os.sep + 'config'
        if os.path.exists(config_dir):
            # set path in case using functions defined and hene imported from in settings file
            sys.path.insert(0, config_dir)
        with open(fname, 'rb') as inp:
            return pickle.load(inp)
    except Exception as e:
        print('Error lading cached batch object: %s', e)
        resetGrid(directory)
        if gridconfig.pathIsGrid(directory):
            return gridconfig.makeGrid(directory, readOnly=True, interactive=False)
        raise
示例#4
0
#!/usr/bin/env python

from paramgrid import gridconfig

args = gridconfig.getArgs()
args.interactive = True
gridconfig.makeGrid(**args.__dict__)