Changeset 26344
- Timestamp:
- 07/09/21 13:28:16 (4 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/clusters/cloud.m
r26332 r26344 20 20 21 21 %initialize cluster using user settings if provided 22 if (exist('cloud_settings')==2), 23 eval('cloud_settings');22 if (exist('cloud_settings')==2), 23 cloud_settings; 24 24 end 25 25 … … 29 29 %}}} 30 30 function disp(cluster) % {{{ 31 % 31 %display the object 32 32 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 33 33 disp(sprintf(' name: %s',cluster.name)); … … 53 53 fid=fopen([modelname '.queue'],'w'); 54 54 fprintf(fid,'#!/bin/bash\n'); 55 if cluster.interactive 56 fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh'); 57 fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]); 58 fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s %s 2> %s.errlog > /dev/stdout | tee %s.outlog ',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname); 59 else 60 fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh'); 61 fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]); 62 fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s %s 2> %s.errlog > /dev/stdout | tee %s.outlog ',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname); 63 end 55 fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh'); 56 fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]); 57 fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s/%s %s 2> %s.errlog > /dev/stdout | tee %s.outlog',cluster.np,cluster.codepath,solution,cluster.executionpath,dirname,modelname,modelname,modelname); 64 58 end 65 59 %}}} … … 88 82 else 89 83 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 90 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz 84 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz']; 91 85 end 92 86 else 93 87 disp('launching solution sequence on remote cluster'); 94 88 if ~isempty(restart) 95 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue'];89 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue']; 96 90 else 97 91 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 98 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue'];92 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue']; 99 93 end 100 94 end -
issm/trunk-jpl/src/m/classes/clusters/cyclone.py
r26332 r26344 1 1 import subprocess 2 from fielddisplay import fielddisplay 3 from pairoptions import pairoptions 4 from issmssh import issmssh 5 from issmscpin import issmscpin 6 from issmscpout import issmscpout 2 7 3 try: 8 4 from cyclone_settings import cyclone_settings 9 5 except ImportError: 10 6 print('You need cyclone_settings.py to proceed, check presence and sys.path') 7 from fielddisplay import fielddisplay 8 from helpers import * 9 from pairoptions import pairoptions 10 from issmscpin import issmscpin 11 from issmscpout import issmscpout 12 from issmssh import issmssh 11 13 12 14 … … 96 98 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 97 99 print('launching solution sequence on remote cluster') 98 if restart:100 if not isempty(restart): 99 101 launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname) 100 102 else: -
issm/trunk-jpl/src/m/classes/clusters/discover.py
r26340 r26344 6 6 print('You need discover_settings.py to proceed, check presence and sys.path') 7 7 from fielddisplay import fielddisplay 8 from helpers import * 8 9 from IssmConfig import IssmConfig 9 10 from issmscpin import issmscpin … … 11 12 from issmssh import issmssh 12 13 from MatlabFuncs import * 13 import math14 import numpy as np15 14 from pairoptions import pairoptions 16 15 from QueueRequirements import QueueRequirements … … 60 59 def __repr__(self): # {{{ 61 60 # Display the object 62 s = 'class pfeobject\n'61 s = 'class discover object\n' 63 62 s += ' name: {}\n'.format(self.name) 64 63 s += ' login: {}\n'.format(self.login) … … 87 86 88 87 def checkconsistency(self, md, solution, analyses): # {{{ 89 queuedict = {'long': [24 *60*60, 560],90 'allnccs': [12 *60*60, 6000],91 'debug': [1 *60*60, 532]}88 queuedict = {'long': [24 * 60 * 60, 560], 89 'allnccs': [12 * 60 * 60, 6000], 90 'debug': [1 * 60 * 60, 532]} 92 91 QueueRequirements(queuedict, self.queue, self.nprocs(), self.time) 93 92 … … 136 135 fid.write('#SBATCH -n {} \n'.format(self.nprocs())) 137 136 fid.write('#SBATCH -N {} \n'.format(self.numnodes)) 138 fid.write('#SBATCH -t {:02d}:{:02d}:00 \n'.format( int(math.floor(self.time / 3600)), int(math.floor(self.time % 3600) / 60)))137 fid.write('#SBATCH -t {:02d}:{:02d}:00 \n'.format(floor(self.time / 3600), floor(self.time % 3600) / 60)) 139 138 fid.write('#SBATCH -A {} \n\n'.format(self.grouplist)) 140 139 if (self.email.find('@')>-1): … … 196 195 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 197 196 if self.interactive: 198 if restart:197 if not isempty(restart): 199 198 launchcommand = 'cd {}/Interactive{}'.format(self.executionpath, self.interactive) 200 199 else: 201 200 launchcommand = 'cd {}/Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname) 202 201 else: 203 if restart:202 if not isempty(restart): 204 203 launchcommand = 'cd {} && cd {} && sbatch {}.queue'.format(self.executionpath, dirname, modelname) 205 204 else: -
issm/trunk-jpl/src/m/classes/clusters/fram.py
r26332 r26344 1 1 import subprocess 2 2 3 import numpy as np 4 3 5 from fielddisplay import fielddisplay 4 from pairoptions import pairoptions5 from issmssh import issmssh6 from issmscpin import issmscpin7 from issmscpout import issmscpout8 from QueueRequirements import QueueRequirements9 from IssmConfig import IssmConfig10 6 try: 11 7 from fram_settings import fram_settings 12 8 except ImportError: 13 9 print('You need fram_settings.py to proceed, check presence and sys.path') 10 from helpers import * 11 from pairoptions import pairoptions 12 from IssmConfig import IssmConfig 13 from issmscpin import issmscpin 14 from issmscpout import issmscpout 15 from issmssh import issmssh 16 from QueueRequirements import QueueRequirements 14 17 15 18 … … 147 150 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 148 151 print('launching solution sequence on remote cluster') 149 if restart:152 if not isempty(restart): 150 153 launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname) 151 154 else: -
issm/trunk-jpl/src/m/classes/clusters/pfe.m
r26332 r26344 138 138 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 139 139 if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end 140 if ~isempty(cluster.interactive), md = checkmessage(md,'interactive mode not implemented'); end141 140 142 141 end … … 163 162 fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor); 164 163 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. 165 fprintf(fid,'#PBS -q %s 164 fprintf(fid,'#PBS -q %s\n',cluster.queue); 166 165 fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist); 167 166 fprintf(fid,'#PBS -m e\n'); … … 431 430 else 432 431 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 433 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz 432 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 434 433 end 435 434 end -
issm/trunk-jpl/src/m/classes/clusters/pfe.py
r26333 r26344 2 2 3 3 from fielddisplay import fielddisplay 4 from helpers import * 4 5 from IssmConfig import IssmConfig 5 6 from issmscpin import issmscpin … … 140 141 if not self.grouplist: 141 142 md = md.checkmessage('grouplist empty') 142 if self.interactive == 1:143 md = md.checkmessage('interactive mode not implemented')144 143 145 144 return self … … 182 181 183 182 fid.close() 184 185 183 # }}} 186 184 … … 200 198 # Launch command, to be executed via ssh 201 199 if self.interactive: 202 if restart:200 if not isempty(restart): 203 201 launchcommand = 'cd {} /Interactive{}'.format(self.executionpath, self.interactive) 204 202 else: … … 208 206 launchcommand = 'cd {} /Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname) 209 207 else: 210 if restart:208 if not isempty(restart): 211 209 launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname) 212 210 else: -
issm/trunk-jpl/src/m/classes/clusters/saga.py
r26332 r26344 1 import datetime 1 2 import subprocess 3 2 4 from fielddisplay import fielddisplay 3 from pairoptions import pairoptions4 from issmssh import issmssh5 from helpers import * 6 from IssmConfig import IssmConfig 5 7 from issmscpin import issmscpin 6 8 from issmscpout import issmscpout 9 from issmssh import issmssh 10 from pairoptions import pairoptions 7 11 from QueueRequirements import QueueRequirements 8 from IssmConfig import IssmConfig9 import datetime10 12 try: 11 13 from saga_settings import saga_settings … … 157 159 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 158 160 print('launching solution sequence on remote cluster') 159 if restart:161 if not isempty(restart): 160 162 launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname) 161 163 else: -
issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py
r26184 r26344 9 9 10 10 def gmshplanet(*args): 11 ''' 12 GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo 11 """GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo 13 12 14 13 Available options (for more details see ISSM website http://issm.jpl.nasa.gov/): … … 18 17 - refinemetric: mesh quantity to specify resolution 19 18 20 19 Returns 'mesh3dsurface' type mesh 21 20 22 23 24 25 '''21 Examples: 22 md.mesh = gmshplanet('radius', 6000, 'resolution', 100); 23 md.mesh = gmshplanet('radius', 6000, 'resolution', 100); 24 """ 26 25 27 26 # Get Gmsh version … … 35 34 raise RuntimeError("gmshplanet: Gmsh major version {} not supported!".format(gmshmajorversion)) 36 35 37 # process options36 # Process options 38 37 options = pairoptions(*args) 39 38 #options = deleteduplicates(options, 1) 40 39 41 # recover parameters:40 # Recover parameters 42 41 radius = options.getfieldvalue('radius') * 1000 43 42 resolution = options.getfieldvalue('resolution') * 1000 44 43 45 # initialize mesh:44 # Initialize mesh 46 45 mesh = mesh3dsurface() 47 # create .geo file: {{{46 # Create .geo file: {{{ 48 47 fid = open('sphere.geo', 'w') 49 48 … … 108 107 metric = options.getfieldvalue('refinemetric') 109 108 110 #create .pos file with existing mesh and refining metric: {{{109 # Create .pos file with existing mesh and refining metric: {{{ 111 110 fid = open('sphere.pos', 'w') 112 111 … … 120 119 fid.write('];\n') 121 120 fid.close() 122 #}}}121 #}}} 123 122 124 123 # Call gmsh … … 133 132 subprocess.call('gmsh -tol 1e-8 -2 -format msh2 sphere.geo', shell=True) 134 133 135 # import mesh:{{{134 # Import mesh {{{ 136 135 fid = open('sphere.msh', 'r') 137 136 138 # Get Mesh format137 # Get mesh format 139 138 A = fid.readline().strip() 140 139 if A != '$MeshFormat': … … 146 145 raise RuntimeError(['Expecting $EndMeshFormat (', A, ')']) 147 146 148 # Nodes147 # Nodes 149 148 A = fid.readline().strip() 150 149 if A != '$Nodes': … … 165 164 raise RuntimeError(['Expecting $EndNodes (', A, ')']) 166 165 167 # Elements166 # Elements 168 167 A = fid.readline().strip() 169 168 if A != '$Elements': … … 186 185 mesh.long = np.arctan2(mesh.y, mesh.x) / np.pi * 180 187 186 188 # erase files:187 # Erase files 189 188 subprocess.call('rm -rf sphere.geo sphere.msh sphere.pos', shell=True) 190 189 191 # return mesh:190 # Return mesh 192 191 return mesh -
issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py
r26332 r26344 8 8 """ 9 9 10 def acosd(X): #{{{10 def acosd(X): #{{{ 11 11 """ function acosd - Inverse cosine in degrees 12 12 … … 19 19 #}}} 20 20 21 def asind(X): #{{{21 def asind(X): #{{{ 22 22 """ function asind - Inverse sine in degrees 23 23 … … 30 30 #}}} 31 31 32 def atand(X): #{{{32 def atand(X): #{{{ 33 33 """ function atand - Inverse tangent in degrees 34 34 … … 42 42 43 43 44 def atan2d(Y, X): #{{{45 """ 44 def atan2d(Y, X): #{{{ 45 """function atan2d - Four-quadrant inverse tangent in degrees 46 46 47 47 Usage: … … 53 53 #}}} 54 54 55 def det(a): #{{{55 def det(a): #{{{ 56 56 if a.shape == (1, ): 57 57 return a[0] … … 64 64 #}}} 65 65 66 def find(*args): #{{{ 66 def error(msg): #{{{ 67 raise Exception(msg) 68 #}}} 69 70 def etime(t2, t1): #{{{ 71 return t2 - t1 72 #}}} 73 74 def find(*args): #{{{ 67 75 nargs = len(args) 68 76 if nargs >= 1 or nargs <= 2: … … 80 88 #}}} 81 89 82 def heaviside(x): #{{{ 90 def floor(X): #{{{ 91 import math 92 93 return int(math.floor(X)) 94 #}}} 95 96 def heaviside(x): #{{{ 83 97 import numpy as np 84 98 … … 90 104 #}}} 91 105 92 def ismac(): #{{{ 106 def isfile(fileName): #{{{ 107 import os 108 109 return os.path.exists(fileName) 110 #}}} 111 112 def ismac(): #{{{ 93 113 import platform 94 114 … … 99 119 #}}} 100 120 101 def ismember(a, s): #{{{121 def ismember(a, s): #{{{ 102 122 import numpy as np 103 123 … … 121 141 #}}} 122 142 123 def ispc(): #{{{ 143 def isnan(A): #{{{ 144 import numpy as np 145 146 return np.isnan(A) 147 #}}} 148 149 def ispc(): #{{{ 124 150 import platform 125 151 … … 130 156 #}}} 131 157 132 def mod(a, m): #{{{ 158 def isprop(obj, PropertyName): #{{{ 159 return hasattr(obj, PropertyName) 160 #}}} 161 162 def mod(a, m): #{{{ 133 163 return a % m 134 164 #}}} 135 165 136 def oshostname(): #{{{ 166 def pause(n): #{{{ 167 import time 168 169 time.sleep(n) 170 #}}} 171 172 def pwd(): #{{{ 173 import os 174 175 return os.getcwd() 176 #}}} 177 178 def oshostname(): #{{{ 137 179 import socket 138 180 … … 140 182 #}}} 141 183 142 def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0): #{{{ 184 def rem(a, b): #{{{ 185 return a % b 186 #}}} 187 188 def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0): #{{{ 143 189 import numpy as np 144 190 … … 156 202 #}}} 157 203 158 def strcmp(s1, s2): #{{{204 def strcmp(s1, s2): #{{{ 159 205 if s1 == s2: 160 206 return True … … 163 209 #}}} 164 210 165 def strcmpi(s1, s2): #{{{211 def strcmpi(s1, s2): #{{{ 166 212 if s1.lower() == s2.lower(): 167 213 return True … … 170 216 #}}} 171 217 172 def strjoin(*args): #{{{218 def strjoin(*args): #{{{ 173 219 nargs = len(args) 174 220 if nargs >= 1 or nargs <= 2: … … 181 227 #}}} 182 228 183 def strncmp(s1, s2, n): #{{{229 def strncmp(s1, s2, n): #{{{ 184 230 if s1[0:n] == s2[0:n]: 185 231 return True … … 188 234 #}}} 189 235 190 def strncmpi(s1, s2, n): #{{{236 def strncmpi(s1, s2, n): #{{{ 191 237 if s1.lower()[0:n] == s2.lower()[0:n]: 192 238 return True -
issm/trunk-jpl/src/m/solve/solve.py
r26307 r26344 106 106 pass # do nothing 107 107 else: 108 if restart:108 if not isempty(restart): 109 109 md.private.runtimename = restart 110 110 else: -
issm/trunk-jpl/src/m/solve/waitonlock.m
r26039 r26344 37 37 38 38 %initialize time and file presence test flag 39 time=0; ispresent=0; time0=clock;39 elapsedtime=0; ispresent=0; starttime=clock; 40 40 disp(['waiting for ' lockfilename ' hold on... (Ctrl+C to exit)']) 41 41 … … 58 58 59 59 %loop till file .lock exist or time is up 60 while (ispresent==0 & time<timelimit)60 while (ispresent==0 & elapsedtime<timelimit) 61 61 if strcmpi(oshostname(),cluster.name), 62 62 pause(1); 63 63 ispresent=(exist(lockfilename,'file') & exist(logfilename,'file')); 64 time=etime(clock,time0)/60;64 elapsedtime=etime(clock,starttime)/60; 65 65 else 66 66 pause(5); 67 time=etime(clock,time0);68 fprintf('\rchecking for job completion (time: %i min %i sec) ',floor( time/60),floor(rem(time,60)));69 time=time/60; %converts time from sec to min67 elapsedtime=etime(clock,starttime); 68 fprintf('\rchecking for job completion (time: %i min %i sec) ',floor(elapsedtime/60),floor(rem(elapsedtime,60))); 69 elapsedtime=elapsedtime/60; %converts time from sec to min 70 70 ispresent=~system(command); 71 71 if ispresent, fprintf('\n'); end … … 74 74 75 75 %build output 76 if ( time>timelimit),76 if (elapsedtime>timelimit), 77 77 disp('Time limit exceeded. Increase md.settings.waitonlock'); 78 78 disp('The results must be loaded manually with md=loadresultsfromcluster(md).'); -
issm/trunk-jpl/src/m/solve/waitonlock.py
r26332 r26344 1 import os 1 import subprocess 2 import sys 2 3 import time 3 4 from MatlabFuncs import * … … 6 7 """WAITONLOCK - wait for a file 7 8 8 This routine will return when a file named 'filename' is written to disk. 9 If the time limit given in input is exceeded, return 0 9 This routine will return when a file named 'lockfilename' is written to 10 disk. Also check for outlog file because it might be written several 11 seconds after the lock file. 12 13 If the time limit given in input is exceeded, return 0. 10 14 11 15 Usage: … … 13 17 """ 14 18 15 # Getfilename (lock file) and options19 # Get lockfilename (lock file) and options 16 20 executionpath = md.cluster.executionpath 17 cluster = md.cluster.name18 21 timelimit = md.settings.waitonlock 19 filename = os.path.join(executionpath, md.private.runtimename, md.miscellaneous.name + '.lock')22 cluster = md.cluster 20 23 21 #waitonlock will work if the lock is on the same machine only: 22 if not strcmpi(oshostname(), cluster): 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: 29 lockfilename = '{}/Interactive{}/{}.lock'.format(executionpath, cluster.interactive, md.miscellaneous.name) 30 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) 34 else: 35 lockfilename = '{}/{}/{}.lock'.format(executionpath, md.private.runtimename, md.miscellaneous.name) 36 logfilename = '{}/{}/{}.outlog'.format(executionpath, md.private.runtimename, md.miscellaneous.name) 23 37 24 print('solution launched on remote cluster. log in to detect job completion.') 25 choice = eval(input('Is the job successfully completed? (y / n) ')) 26 if not strcmp(choice, 'y'): 27 print('Results not loaded... exiting') 28 flag = 0 38 # 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'): 40 # We are in interactive mode, no need to check for job completion 41 return 1 42 43 # Initialize time and file presence test flag 44 elapsedtime = 0 45 ispresent = 0 46 starttime = time.time() 47 print('waiting for {} hold on... (Ctrl+C to exit)'.format(lockfilename)) 48 49 # Prepare command if the job is not running on the local machine 50 if not strcmpi(oshostname(), cluster.name): 51 login = cluster.login 52 port = 0 53 if isprop(cluster, 'port'): 54 port = cluster.port 55 if port: 56 command = 'ssh -l {} -p {} localhost "[ -f {} ] && [ -f {} ]" 2>/dev/null'.format(login, port, lockfilename, logfilename) 57 elif cluster.name == 'cloud': 58 command = '[ -f {} ] && [ -f {} ] 2>/dev/null'.format(lockfilename, logfilename) 59 command = '{} sshmaster {} --user {} \'{}\''.format(starcluster(), cluster.name, cluster.login, command) 29 60 else: 30 flag = 161 command = 'ssh -l {} {} "[ -f {} ] && [ -f {} ]" 2>/dev/null'.format(login, cluster.name, lockfilename, logfilename) 31 62 32 #job is running on the same machine 33 else: 34 if 'interactive' in vars(md.cluster) and md.cluster.interactive: 35 #We are in interactive mode, no need to check for job completion 36 flag = 1 37 return flag 38 #initialize time and file presence test flag 39 etime = 0 40 ispresent = 0 41 print(("waiting for '%s' hold on... (Ctrl + C to exit)" % filename)) 63 while not ispresent and elapsedtime < timelimit: 64 if strcmpi(oshostname(), cluster.name): 65 pause(1) 66 ispresent = (isfile(lockfilename) and isfile(logfilename)) 67 elapsedtime = etime(time.time(), starttime) / 60 68 else: 69 pause(5) 70 elapsedtime = etime(time.time(), starttime) 71 sys.stdout.write('\rchecking for job completion (time: {} min {} sec) '.format(floor(elapsedtime / 60), floor(rem(elapsedtime, 60)))) # TODO: After Python 2 is deprecated, we can change this call to print([...], end='') 72 elapsedtime = elapsedtime / 60 # Converts time from sec to min 73 subproc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 74 outs, errs = subproc.communicate() # NOTE: Need to consume output before checking return code 75 if errs != '': 76 raise Exception("waitonlock: check for existence of files failed: {}".format(errs)) 77 ispresent = not subproc.returncode 78 if ispresent: 79 print('') 42 80 43 #loop till file .lock exist or time is up44 while ispresent == 0 and etime <timelimit:45 ispresent = os.path.exists(filename)46 time.sleep(1)47 etime += 1 / 6081 # Build output 82 if elapsedtime > timelimit: 83 print('Time limit exceeded. Increase md.settings.waitonlock') 84 print('The results must be loaded manually with md = loadresultsfromcluster(md).') 85 raise RuntimeError('waitonlock error message: time limit exceeded.') 48 86 49 #build output 50 if etime > timelimit: 51 print('Time limit exceeded. Increase md.settings.waitonlock') 52 print('The results must be loaded manually with md = loadresultsfromcluster(md).') 53 raise RuntimeError('waitonlock error message: time limit exceeded.') 54 flag = 0 55 else: 56 flag = 1 57 58 return flag 87 return ispresent -
issm/trunk-jpl/src/wrappers/javascript/Makefile.am
r26343 r26344 8 8 9 9 js_scripts = ${ISSM_DIR}/src/wrappers/BamgMesher/BamgMesher.js \ 10 ${ISSM_DIR}/src/wrappers/Triangle/Triangle.js\10 ${ISSM_DIR}/src/wrappers/Triangle/Triangle.js \ 11 11 ${ISSM_DIR}/src/wrappers/NodeConnectivity/NodeConnectivity.js\ 12 12 ${ISSM_DIR}/src/wrappers/ContourToMesh/ContourToMesh.js\
Note:
See TracChangeset
for help on using the changeset viewer.