Changeset 26353


Ignore:
Timestamp:
07/18/21 16:19:07 (4 years ago)
Author:
jdquinn
Message:

CHG: Checking on cluster type rather than name in waitonlock.py; silencing cluster settings warnings by default; formatting; cleanup

Location:
issm/trunk-jpl
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/clusters/generic.py

    r26342 r26353  
    66    from generic_settings import generic_settings
    77except ImportError:
    8     print('Warning generic_settings.py not found, default will be used')
     8    #print('Warning: generic.py: generic_settings.py not found, default will be used')
     9    pass
    910from MatlabFuncs import *
    1011from IssmConfig import IssmConfig
     
    4849            self = generic_settings(self)
    4950        except NameError:
    50             print('generic_settings.py not found, using default settings')
     51            # print('generic_settings.py not found, using default settings')
     52            pass
    5153
    5254        # OK get other fields
  • issm/trunk-jpl/src/m/classes/clusters/pfe.py

    r26344 r26353  
    1212    from pfe_settings import pfe_settings
    1313except ImportError:
    14     print('You need pfe_settings.py to proceed, check presence and sys.path')
     14    # print('You need pfe_settings.py to proceed, check presence and sys.path')
     15    pass
    1516from QueueRequirements import QueueRequirements
    1617
     
    2526
    2627    def __init__(self, *args):  # {{{
    27         self.name = 'pfe'
     28        self.name = ''
    2829        self.login = ''
    2930        self.modules = ['comp-intel/2016.2.181', 'mpi-sgi/mpt']
     
    5051            self = pfe_settings(self)
    5152        except NameError:
    52             print('pfe_settings.py not found, using default settings')
     53            #print('pfe_settings.py not found, using default settings')
     54            pass
    5355
    5456        # OK get other fields
  • issm/trunk-jpl/src/m/classes/issmsettings.py

    r25685 r26353  
    2121        self.solver_residue_threshold = 0
    2222
    23     #set defaults
     23        # Set defaults
    2424        self.setdefaultparameters()
    25 
    2625    #}}}
    2726
    2827    def __repr__(self):  # {{{
    29         string = "   general issmsettings parameters:"
    30 
    31         string = "%s\n%s" % (string, fielddisplay(self, "results_on_nodes", "list of output for which results will be output for all the nodes of each element, Use 'all' for all output on nodes."))
    32         string = "%s\n%s" % (string, fielddisplay(self, "io_gather", "I / O gathering strategy for result outputs (default 1)"))
    33         string = "%s\n%s" % (string, fielddisplay(self, "lowmem", "is the memory limited ? (0 or 1)"))
    34         string = "%s\n%s" % (string, fielddisplay(self, "output_frequency", "frequency at which results are saved in all solutions with multiple time_steps"))
    35         string = "%s\n%s" % (string, fielddisplay(self, "sb_coupling_frequency", "frequency at which StressBalance solver is coupled (default 1)"))
    36         string = "%s\n%s" % (string, fielddisplay(self, "checkpoint_frequency", "frequency at which the runs are being recorded, allowing for a restart"))
    37         string = "%s\n%s" % (string, fielddisplay(self, "waitonlock", "maximum number of minutes to wait for batch results, or return 0"))
    38         string = "%s\n%s" % (string, fielddisplay(self, "solver_residue_threshold", "throw an error if solver residue exceeds this value (NaN to deactivate)"))
    39         return string
     28        s = "   general issmsettings parameters:\n"
     29        s += '{}\n'.format(fielddisplay(self, "results_on_nodes", "list of output for which results will be output for all the nodes of each element, Use 'all' for all output on nodes."))
     30        s += '{}\n'.format(fielddisplay(self, "io_gather", "I / O gathering strategy for result outputs (default 1)"))
     31        s += '{}\n'.format(fielddisplay(self, "lowmem", "is the memory limited ? (0 or 1)"))
     32        s += '{}\n'.format(fielddisplay(self, "output_frequency", "frequency at which results are saved in all solutions with multiple time_steps"))
     33        s += '{}\n'.format(fielddisplay(self, "sb_coupling_frequency", "frequency at which StressBalance solver is coupled (default 1)"))
     34        s += '{}\n'.format(fielddisplay(self, "checkpoint_frequency", "frequency at which the runs are being recorded, allowing for a restart"))
     35        s += '{}\n'.format(fielddisplay(self, "waitonlock", "maximum number of minutes to wait for batch results, or return 0"))
     36        s += '{}\n'.format(fielddisplay(self, "solver_residue_threshold", "throw an error if solver residue exceeds this value (NaN to deactivate)"))
     37        return s
    4038    #}}}
    4139
  • issm/trunk-jpl/src/m/classes/model.py

    r26301 r26353  
    3737from toolkits import toolkits
    3838from generic import generic
    39 from pfe import pfe
    40 from cyclone import cyclone
    41 from saga import saga
    4239from balancethickness import balancethickness
    4340from stressbalance import stressbalance
  • issm/trunk-jpl/src/m/classes/solidearthsettings.py

    r26317 r26353  
    118118        # A GRD computation has been requested, make some checks on the nature of the meshes provided
    119119        if self.isgrd:
    120             if md.mesh.__class__.__name__ is 'mesh3dsurface':
     120            if md.mesh.__class__.__name__ == 'mesh3dsurface':
    121121                if self.grdmodel == 2:
    122122                    raise RuntimeException('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)')
  • issm/trunk-jpl/src/m/coordsystems/gdaltransform.m

    r25455 r26353  
    2020%                       +proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs
    2121%
    22 %       To get proj.4 string from EPSG, use gdalsrsinfo. Example:
     22%       To get PROJ.4 string from EPSG, use gdalsrsinfo. Example:
    2323%               gdalsrsinfo epsg:4326 | grep "PROJ.4" | sed "s/PROJ.4 : //"
    2424
  • issm/trunk-jpl/src/m/dev/devpath.py

    r26352 r26353  
    1515        dirs.remove('.svn')
    1616    for file in files:
    17         if file.find(".py") != -1:
    18             if file.find(".pyc") == -1:
     17        if file.find('.py') != -1:
     18            if file.find('.pyc') == -1:
    1919                if root not in sys.path:
    2020                    sys.path.append(root)
     
    4646#c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
    4747
    48 print("\n  ISSM development path correctly loaded")
    49 print("Current path is {}\n\n".format(ISSM_DIR))
     48# print("\n  ISSM development path correctly loaded")
     49# print("Current path is {}\n\n".format(ISSM_DIR))
  • issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py

    r26344 r26353  
    104104#}}}
    105105
     106def isa(A, dataType):  #{{{
     107    """FUNCTION ISA
     108
     109    NOTE:
     110    - Takes a type as its second argument (in contrast to the MATLAB function
     111    that it replicates, which takes a string representing the name of a type)
     112    """
     113    return type(A) == dataType
     114#}}}
     115
    106116def isfile(fileName):  #{{{
    107117    import os
  • issm/trunk-jpl/src/m/plot/googlemaps.m

    r25189 r26353  
    175175delete('temp.png');
    176176
    177 %If not gdal, exit
     177%If not GDAL, exit
    178178if status~=0,
    179179        disp(result);
    180         disp('googlemaps info: gdal not found or not working properly, the Google image will not be transformed');
     180        disp('googlemaps info: GDAL not found or not working properly, the Google image will not be transformed');
    181181        [gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1);
    182182        [LAT LON]=pixelstolatlon(gX,gY, zoom);
     
    204204if ~isempty(strfind(result,'ERROR')),
    205205        disp(result);
    206         disp(' ');disp('googlemaps info: gdal not working properly (missing proj.4 library?), Google image will not be transformed');
     206        disp(' ');disp('googlemaps info: GDAL not working properly (missing PROJ.4 library?), Google image will not be transformed');
    207207        disp(result);
    208208        [gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1);
  • issm/trunk-jpl/src/m/plot/plot_manager.py

    r25065 r26353  
    33    overlaysupport = True
    44except ImportError:
    5     print('osgeo/gdal for python not installed, overlay plots are not enabled')
     5    print('OSGeo/GDAL for Python not installed, overlay plots are not enabled')
    66    overlaysupport = False
    77
     
    2020
    2121def plot_manager(md, options, fig, axgrid, gridindex):
    22     '''
    23     PLOT_MANAGER - distribute the plots called by plotmodel
     22    """PLOT_MANAGER - distribute the plots called by plotmodel
    2423
    2524    'fig' is a handle to the figure instance created by plotmodel.
     
    3534
    3635    See also: PLOTMODEL, PLOT_UNIT
    37     '''
     36    """
    3837    #parse options and get a structure of options
    3938    options = checkplotoptions(md, options)
     
    4645    # TODO: Check why we are doing this and if it is absolutely necessary (see
    4746    #       also src/m/plot/plot_mesh.py, src/m/plot/applyoptions.py)
     47    #
    4848    options.addfielddefault('ticklabels', 'on')
    4949
  • issm/trunk-jpl/src/m/plot/plot_overlay.py

    r25065 r26353  
    1111    from osgeo import gdal
    1212except ImportError:
    13     print('osgeo/gdal for python not installed, plot_overlay is disabled')
     13    print('OSGeo/GDAL for python not installed, plot_overlay is disabled')
    1414
    1515from processdata import processdata
     
    1919
    2020def plot_overlay(md, data, options, ax):
    21     '''
    22     Function for plotting a georeferenced image. Called from plot_manager by
     21    """Function for plotting a georeferenced image. Called from plot_manager by
    2322    call to plotmodel.
    2423
     
    2726
    2827    See also: PLOTMODEL
    29     '''
     28    """
    3029
    3130    x, y, z, elements, is2d, isplanet = processmesh(md, [], options)
  • issm/trunk-jpl/src/m/plot/radarpower.m

    r26047 r26353  
    2929d = getfieldvalue(options,'overlay_adjust_d',1);
    3030
    31 %find gdal coordinates
     31%find GDAL coordinates
    3232x0=min(xlim); x1=max(xlim);
    3333y0=min(ylim); y1=max(ylim);
  • issm/trunk-jpl/src/m/solve/solve.m

    r26307 r26353  
    173173        end
    174174elseif md.settings.waitonlock>0,
    175         %we wait for the done file
     175        %wait for done file
    176176        done=waitonlock(md);
    177177        if md.verbose.solution,
  • issm/trunk-jpl/src/m/solve/solve.py

    r26344 r26353  
    141141    if md.qmu.isdakota:
    142142        filelist.append(modelname + '.qmu.in')
    143        
     143
    144144    if not restart:
    145145        cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist)
     
    150150    # Wait on lock
    151151    if md.settings.waitonlock > 0:
    152         islock = waitonlock(md)
    153         if islock == 0: # no results to be loaded
    154             print('The results must be loaded manually with md = loadresultsfromcluster(md).')
    155         else: # load results
    156             if md.verbose.solution:
    157                 print('loading results from cluster')
    158             md = loadresultsfromcluster(md)
     152        # Wait for done file
     153        done = waitonlock(md)
     154        if md.verbose.solution:
     155            print('loading results from cluster')
     156        md = loadresultsfromcluster(md)
     157    elif md.settings.waitonlock == 0:
     158        print('Model results must be loaded manually with md = loadresultsfromcluster(md).')
    159159
    160160    return md
  • issm/trunk-jpl/src/m/solve/waitonlock.m

    r26344 r26353  
    55%   disk. Also check for outlog file be cause it might be written several
    66%   seconds after the lock file.
     7%
    78%   If the time limit given in input is exceeded, return 0
    89%
  • issm/trunk-jpl/src/m/solve/waitonlock.py

    r26347 r26353  
    22import sys
    33import time
     4from generic import *
     5from generic_static import *
     6# from localpfe import *
    47from MatlabFuncs import *
     8from pfe import *
    59
    610def waitonlock(md):
     
    1519    Usage:
    1620        flag = waitonlock(md)
     21
     22    TODO:
     23    - Uncomment import of localpfe and check on cluster type once localpfe.py
     24    has been translated from localpfe.m.
    1725    """
    1826
     
    2230    cluster = md.cluster
    2331
    24     """
    25     NOTE: We check cluster.name against string as cluster classes are not
    26           defined globally and we do not have to import them all
    27     """
    28     if cluster.name == 'pfe' and cluster.interactive > 1:
     32    if isa(cluster, pfe) and cluster.interactive > 1:
    2933        lockfilename = '{}/Interactive{}/{}.lock'.format(executionpath, cluster.interactive, md.miscellaneous.name)
    3034        logfilename = '{}/Interactive{}/{}.outlog'.format(executionpath, cluster.interactive, md.miscellaneous.name)
    31     elif cluster.name == 'localpfe':
    32         lockfilename = '{}/{}.lock'.format(executionpath, md.miscellaneous.name)
    33         logfilename = '{}/{}.outlog'.format(executionpath, md.miscellaneous.name)
     35    # elif isa(cluster, localpfe):
     36    #     lockfilename = '{}/{}.lock'.format(executionpath, md.miscellaneous.name)
     37    #     logfilename = '{}/{}.outlog'.format(executionpath, md.miscellaneous.name)
    3438    else:
    3539        lockfilename = '{}/{}/{}.lock'.format(executionpath, md.private.runtimename, md.miscellaneous.name)
     
    3741
    3842    # If we are using the generic cluster in interactive mode, job is already complete
    39     if (cluster.name == 'generic' and cluster.interactive) or (cluster.name == 'generic_static'):
     43    if (isa(cluster, generic) and cluster.interactive) or (isa(cluster, generic_static)):
    4044        # We are in interactive mode, no need to check for job completion
    4145        return 1
     
    7377            subproc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    7478            outs, errs = subproc.communicate() # NOTE: Need to consume output before checking return code
     79
    7580            # TODO: Debug the following check under Linux (exits after first iteration with errs = "b")
    7681            # UPDATE: Works in testing under Debian Linux system. Leaving comment for now so that it is easier to backtrace this issue if someone else encounters it.
    7782            #
    7883            if errs != '':
    79                 raise Exception("waitonlock: check for existence of files failed: {}".format(errs))
     84                raise Exception('waitonlock: check for existence of files failed: {}'.format(errs))
    8085            ispresent = not subproc.returncode
    8186            if ispresent:
  • issm/trunk-jpl/test/NightlyRun/runme.py

    r26350 r26353  
    1010
    1111try:
    12     from parallelrange import parallelrange
    13 except ImportError:  #we don't have issm code in path, just get it
     12    from arch import archread
     13except: # ISSM_DIR is not on path
    1414    import devpath
    15     from parallelrange import parallelrange
     15
    1616from arch import archread
    1717from arch import archwrite
    1818from GetIds import *
    1919from IdToName import IdToName
     20from parallelrange import parallelrange
    2021
    2122
     
    3334
    3435    Options:
    35         -i/--id             followed by the list of ids or (parts of) test names requested
    36                             NOTE: runs all tests by default
    37         -e/--exclude        ids or (parts of) test names to be excluded (same format as id)
    38                             NOTE: exclude does nothing if 'id' is specified with different values
    39         -b/--benchmark      'all'           : (all of the tests)
    40                             'nightly'       : (nightly run/daily run)
    41                             'validation'    : (validation)
    42                             'adolc'         : validation of adolc tests
    43                             'eismint'       : validation of eismint tests
    44                             'ismip'         : validation of ismip-hom tests
    45                             'mesh'          : validation of mesh tests
    46                             'qmu'           : validation of qmu tests
    47                             'referential'   : validation of referential tests
    48                             'slc'           : validation of slc tests
    49                             'thermal'       : validation of thermal tests
    50                             'tranforcing'   : validation of transient forcing tests
    51         -p/--procedure      'check'         : run the test (default)
    52                             'update'        : update the archive
     36        -i/--id         Followed by the list of ids or (parts of) test names
     37                        requested
     38        -e/--exclude    Ids or (parts of) test names to be excluded (same
     39                        format as id). Does nothing if 'id' is specified with
     40                        different values.
     41        -b/--benchmark  'all'           : (all of the tests)
     42                        'nightly'       : (nightly run/daily run)
     43                        'validation'    : (validation)
     44                        'adolc'         : validation of adolc tests
     45                        'eismint'       : validation of eismint tests
     46                        'ismip'         : validation of ismip-hom tests
     47                        'mesh'          : validation of mesh tests
     48                        'qmu'           : validation of qmu tests
     49                        'referential'   : validation of referential tests
     50                        'slc'           : validation of slc tests
     51                        'thermal'       : validation of thermal tests
     52                        'tranforcing'   : validation of transient forcing tests
     53        -p/--procedure  'check'         : run the test (default)
     54                        'update'        : update the archive
    5355
    5456    Usage:
     
    103105    #GET ids  {{{
    104106    flist = glob('test*.py')  #File name must start with 'test' and must end by '.py' and must be different than 'test.py'
    105     list_ids = [int(re.search(r'\d+',file.split('.')[0]).group()) for file in flist if not file == 'test.py'] #Keep test id only (skip 'test' and '.py')
     107    list_ids = [int(re.search(r'\d+',file.split('.')[0]).group()) for file in flist if not file == 'test.py'] # Keep test id only (skip 'test' and '.py')
    106108
    107109    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  #Get tests for this cpu only
Note: See TracChangeset for help on using the changeset viewer.