How to use make_symlink method in yandex-tank

Best Python code snippet using yandex-tank

init.py.svn-base

Source:init.py.svn-base Github

copy

Full Screen

...64 def getinp(self, DEST,logger=None): 65 if logger is None: logger=logging.getLogger('pom')66 try:67 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)68 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)69 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger) 70 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger) 71 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask.united"),72 jn2r(DEST,"fort.66"),True,logger=logger)73 make_symlink(jn2r(self.FIXhwrf,"gfdl_gdem."+mm+".ascii"),74 jn2r(DEST,"fort.8"),True,logger=logger)75 make_symlink(jn2r(self.FIXhwrf,"gfdl_gdem."+mm1+".ascii"),76 jn2r(DEST,"fort.90"),True,logger=logger)77 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_readu.dat."+mm),78 jn2r(DEST,"fort.24"),True,logger=logger) 79 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup_gdem3.dat."+mm),80 jn2r(DEST,"fort.82"),True,logger=logger)81 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup_gspath."+mm),82 jn2r(DEST,"fort.50"),True,logger=logger)83 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.BAYuf"),84 jn2r(DEST,"fort.55"),True,logger=logger)85 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.FSgsuf"),86 jn2r(DEST,"fort.65"),True,logger=logger)87 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.SGYREuf"),88 jn2r(DEST,"fort.75"),True,logger=logger)89 lfile = jn2r(self.LCDIR,"hwrf_gfdl_loop_current_rmy5.dat."+y4+mm+dd)90 rfile = jn2r(self.LCDIR,"hwrf_gfdl_loop_current_wc_ring_rmy5.dat."+y4+mm+dd)91 if Isthis_LCuseful(self.STARTDATE, lfile, rfile,logger=logger):92 make_symlink(lfile,jn2r(DEST,"fort.31"),True,logger=logger)93 make_symlink(rfile,jn2r(DEST,"fort.32"),True,logger=logger) 94 else:95 make_symlink(jn2r(self.PARMhwrf,"hwrf_gfdl_loop_current_rmy5.dat"),96 jn2r(DEST,"fort.31"),True,logger=logger)97 make_symlink(jn2r(self.PARMhwrf,"hwrf_gfdl_loop_current_wc_ring_rmy5.dat"),98 jn2r(DEST,"fort.32"),True,logger=logger)99 inpfile(jn2r(DEST,"fort.91"), [mm, dd],logger=logger)100 inpfile(jn2r(DEST,"input_sharp"),["1"],logger=logger)101 inpfile(jn2r(DEST,"input"),102 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)103 except Exception as e:104 msg='Cannot find input: '+str(e)105 logger.warning(msg,exc_info=True)106 raise POMInputError(msg)107 def setrun(self, DEST,logger=None):108 with NamedDir(DEST) as d:109 if logger is None: logger=logging.getLogger('pom')110 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)111 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)112 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)113 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):114 with open('listing','wb') as f:115 listing=str(produtil.listing.Listing())116 f.write(listing)117 produtil.rusage.getrlimit(logger)118 # Raise stack limit to 6000M119 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)120 xc = self.conf.getexe('hwrf_getsst')121 log = jn2r(DEST,"getsst.out")122 with produtil.rusage.rusage(logger=logger):123 retcode = run(openmp(exe(xc),threads=1).env(OMP_STACKSIZE='128M')124 > log,logger=logger)125 logger.info("hwrf_getsst: err = %s" %(retcode))126 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):127 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False)128 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False)129 logger.info("GFS SST extracted: {0}".format(DEST))130 else:131 msg="hwrf_getsst Failed: NO GFS SST extracted: {0}".format(DEST)132 logger.warning(msg)133 raise POMSSTError(msg)134 else: 135 msg="GFS Spectral Files NOT Found in %s:" %(DEST)136 logger.error(msg)137 raise POMInputError(msg)138 if isnonempty('fort.31') and isnonempty('fort.32'):139 rmall(jn2r(DEST,"fort.13"),jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)140 xc = self.conf.getexe('hwrf_sharp_mcs_rf_l2m_rmy5')141 inp = jn2r(DEST,"input_sharp")142 log = jn2r(DEST,"sharp_mcs_r_l2b.out")143 retcode = run((exe(xc) < inp) >= log,logger=logger)144 logger.info("sharp_mcs_rf: err = %s" %(retcode))145 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.13")):146 deliver_file(jn2r(DEST,"fort.13"),jn2r(DEST,"gfdl_initdata.united."+mm),False,logger=logger)147 logger.info("Specified LC penetration: {0}".format(retcode))148 else:149 deliver_file(jn2r(self.FIXhwrf,"gfdl_initdata.gdem.united."+mm), 150 jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)151 logger.warning("sharp_mcs_rf failed: Climate LC penetration %s" %(retcode))152 else:153 deliver_file(jn2r(self.FIXhwrf,"gfdl_initdata.gdem.united."+mm), 154 jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)155 # Log to highest log level so it is in the jlogfile:156 logger.critical("LC data NOT available: Climate LC penetration %s" %(retcode))157 if os.path.exists(jn2r(DEST,"gfdl_initdata.united."+mm)):158 make_symlink(DEST+"/gfdl_initdata.united."+mm, DEST+"/fort.13",True,logger=logger)159 xc = self.conf.getexe('hwrf_ocean_transatl06prep')160 log = jn2r(DEST,"transatl06prep.out")161 retcode = run(exe(xc) >= log, logger=logger)162 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.113")):163 deliver_file(jn2r(DEST,"fort.113"),jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm),False,logger=logger)164 logger.info("transatl06prep: Success {0}".format(retcode))165 else:166 msg="transatl06prep: Failed {0}".format(retcode)167 logger.warning(msg)168 raise POMPrepError(msg)169 else:170 logger.info("NOT Found in %s:" %("gfdl_initdata.united."+mm)) 171 if os.path.exists(jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm)):172 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)173 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)174 rmall(jn2r(DEST,"fort.13"),logger=logger)175 make_symlink(jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm),jn2r(DEST,"fort.13"),True,logger=logger)176 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+self.DOMAIN+ 177 ".lores"), jn2r(DEST,"fort.66"),True,logger=logger)178 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])179 inp = jn2r(DEST,"input")180 log = jn2r(DEST,"ocean_pomprep.out")181 retcode = run((exe(xc) < inp ) >= log,logger=logger)182 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):183 logger.info("ocean_pomprep: Success %s:" %(self.ODATA))184 return True185 else:186 msg="ocean_pomprep: Failed %s" %(self.ODATA)187 logger.warning(msg)188 raise POMInitFailed(msg)189 else:190 msg="NOT Found in %s:" %(''.join(["gfdl_initdata.",self.DOMAIN,".",mm]))191 logger.warning(msg)192 raise POMInitFailed(msg)193 194class g3(Oceanini):195 def __init__(self, *args,**kargs):196 super(g3,self).__init__(*args,**kargs)197 def getinp(self, DEST,logger=None):198 if logger is None: logger=logging.getLogger('pom')199 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)200 try:201 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)202 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger)203 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger)204 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+205 self.DOMAIN+".lores"),jn2r(DEST,"fort.66"),True,logger=logger)206 make_symlink(jn2r(self.FIXhwrf,"tgdemv3s"+mm+".nc"),207 jn2r(DEST,"tin.nc"),True,logger=logger)208 make_symlink(jn2r(self.FIXhwrf,"sgdemv3s"+mm+".nc"),209 jn2r(DEST,"sin.nc"),True,logger=logger)210 inpfile(jn2r(DEST,"input"),211 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)212 except Exception as e:213 msg='Input Data does NOT exist: %s'%(str(e),)214 logger.error(msg,exc_info=True)215 raise POMInputError(msg)216 def setrun(self, DEST,logger=None):217 with NamedDir(DEST):218 if logger is None: logger=logging.getLogger('pom')219 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)220 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)221 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)222 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):223 produtil.rusage.getrlimit(logger)224 # Raise stack limit to 6000M225 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)226 xc = self.conf.getexe('hwrf_getsst')227 log = jn2r(DEST,"getsst.out")228 retcode = run(exe(xc).env(OMP_STACKSIZE='128M')229 > log,logger=logger)230 logger.info("hwrf_getsst: err = %s" %(retcode))231 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):232 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False,logger=logger)233 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False,logger=logger)234 logger.info("GFS SST extracted: {0}".format(retcode))235 else:236 msg="hwrf_getsst Failed: NO GFS SST extracted %s" %(retcode)237 logger.warning(msg)238 raise POMSSTError(msg)239 else:240 msg="GFS Spectral Files NOT Found in %s:" %(DEST)241 logger.warning(msg)242 raise POMInputError(msg)243 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)244 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)245 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])246 inp = jn2r(DEST,"input")247 log = jn2r(DEST,"ocean_pomprep.out")248 retcode = run((exe(xc) < inp) > log,logger=logger)249 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):250 logging.info("ocean_pomprep: Success %s:" %(self.ODATA))251 return True252 else:253 msg="ocean_pomprep: Failed %s:" %(self.ODATA)254 logger.warning(msg)255 raise POMInitFailed(msg)256 257class na(Oceanini):258 def __init__(self, *args,**kargs):259 super(na,self).__init__(*args,**kargs)260 def getinp(self, DEST, logger=None):261 if logger is None: logger=logging.getLogger('pom')262 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)263 try:264 # RMY: For now, define local variable "NCDADIR" to point to the NCODA input data #265 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)266 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger)267 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger)268 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+269 self.DOMAIN+".lores"),jn2r(DEST,"fort.66"),True,logger=logger)270 NCDADIR="/lfs2/projects/hwrf-vd/hwrf-input/NCODA/"+y4+"/"+y4+mm+dd+"/"271 make_symlink(jn2r(NCDADIR,"seatmp_pre_000000_005000_1o2161x1051_"+272 y4+mm+dd+"00_00000000_analfld"),jn2r(DEST,"fort.48"),True,logger=logger)273 make_symlink(jn2r(NCDADIR,"salint_pre_000000_005000_1o2161x1051_"+274 y4+mm+dd+"00_00000000_analfld"),jn2r(DEST,"fort.49"),True,logger=logger)275 make_symlink(jn2r(self.FIXhwrf,"depths_sfc_000000_000000_1o2161x1051_datafld"),276 jn2r(DEST,"fort.68"),True,logger=logger)277 make_symlink(jn2r(self.FIXhwrf,"grdlon_sfc_000000_000000_1o2161x1051_datafld"),278 jn2r(DEST,"fort.78"),True,logger=logger)279 make_symlink(jn2r(self.FIXhwrf,"grdlat_sfc_000000_000000_1o2161x1051_datafld"),280 jn2r(DEST,"fort.79"),True,logger=logger)281 ##################################################################################282 inpfile(jn2r(DEST,"input"), 283 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)284 except Exception as e:285 msg='Input data does NOT exist: %s'%(str(e),)286 logger.error(msg,exc_info=True)287 raise POMInputError(msg)288 def setrun(self, DEST,logger=None):289 with NamedDir(DEST):290 if logger is None: logger=logging.getLogger('pom')291 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)292 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)293 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)294 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):295 produtil.rusage.getrlimit(logger)296 # Raise stack limit to 6000M297 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)298 xc = self.conf.getexe('hwrf_getsst')299 log = jn2r(DEST,"getsst.out")300 retcode = run(exe(xc).env(OMP_STACKSIZE='128M')301 > log,logger=logger)302 logging.info("hwrf_getsst: err = %s" %(retcode))303 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):304 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False,logger=logger)305 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False,logger=logger)306 logger.info("GFS SST extracted: {0}".format(retcode))307 else:308 msg="hwrf_getsst Failed: NO GFS SST extracted %s"%(retcode)309 logger.warning(msg)310 raise POMSSTError(msg)311 else:312 msg="GFS Spectral Files NOT Found in %s:" %(DEST)313 logger.warning(msg)314 raise POMInputError(msg)315 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)316 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)317 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])318 inp = jn2r(DEST,"input")319 log = jn2r(DEST,"ocean_pomprep.out")320 retcode = run((exe(xc) < inp) >log,logger=logger)321 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):322 logging.info("ocean_pomprep: Success %s:" %(self.ODATA))323 return True324 else:325 msg="ocean_pomprep: Failed %s:" %(self.ODATA)326 logger.warning(msg)327 raise POMInitFailed(msg)328class phase(Oceanini):329 def __init__(self,*args,**kargs):330 super(phase,self).__init__(*args,**kargs)331 def getinp(self, DEST, logger=None):332 if logger is None: logger=logging.getLogger('pom')333 try:334 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)335 SRC = jn2r(self.CSTREAM, self.ODIR)336 make_symlink(jn2r(SRC,self.STORMNAME+".grid.nc"),337 jn2r(DEST,self.STORMNAME+".grid.nc"),True,logger=logger)338 make_symlink(jn2r(SRC,self.STORMNAME+".ts_initial.nc"),339 jn2r(DEST,self.STORMNAME+".ts_initial.nc"),True,logger=logger)340 make_symlink(jn2r(SRC,self.STORMNAME+".ts_clim.nc"),341 jn2r(DEST,self.STORMNAME+".ts_clim.nc"),True,logger=logger)342 make_symlink(jn2r(SRC,self.STORMNAME+".uv_initial.nc"),343 jn2r(DEST,self.STORMNAME+".uv_initial.nc"),True,logger=logger) 344 make_symlink(jn2r(SRC,self.STORMNAME+".el_initial.nc"),345 jn2r(DEST,self.STORMNAME+".el_initial.nc"),True,logger=logger)346 except Exception as e:347 msg='Input data does not exist: %s'%(str(e),)348 logger.warning(msg,exc_info=True)349 raise POMInputError(msg)350 def setrun(self, DEST,logger=None):351 with NamedDir(DEST):352 if logger is None: logger=logging.getLogger('pom')353 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)354 if os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")) and \355 os.path.exists(jn2r(DEST,"pom.nml")):356 exe = self.conf.getexe("hwrf_ocean_init")357 log = jn2r(DEST,"ocean_init.out")358 retcode=run(mpirun(mpi(exe)*9) >= log ,logger=logger)...

Full Screen

Full Screen

init.py

Source:init.py Github

copy

Full Screen

...64 def getinp(self, DEST,logger=None): 65 if logger is None: logger=logging.getLogger('pom')66 try:67 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)68 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)69 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger) 70 make_symlink(jn2r(self.GFSDIR, "gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger) 71 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask.united"),72 jn2r(DEST,"fort.66"),True,logger=logger)73 make_symlink(jn2r(self.FIXhwrf,"gfdl_gdem."+mm+".ascii"),74 jn2r(DEST,"fort.8"),True,logger=logger)75 make_symlink(jn2r(self.FIXhwrf,"gfdl_gdem."+mm1+".ascii"),76 jn2r(DEST,"fort.90"),True,logger=logger)77 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_readu.dat."+mm),78 jn2r(DEST,"fort.24"),True,logger=logger) 79 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup_gdem3.dat."+mm),80 jn2r(DEST,"fort.82"),True,logger=logger)81 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup_gspath."+mm),82 jn2r(DEST,"fort.50"),True,logger=logger)83 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.BAYuf"),84 jn2r(DEST,"fort.55"),True,logger=logger)85 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.FSgsuf"),86 jn2r(DEST,"fort.65"),True,logger=logger)87 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_spinup.SGYREuf"),88 jn2r(DEST,"fort.75"),True,logger=logger)89 lfile = jn2r(self.LCDIR,"hwrf_gfdl_loop_current_rmy5.dat."+y4+mm+dd)90 rfile = jn2r(self.LCDIR,"hwrf_gfdl_loop_current_wc_ring_rmy5.dat."+y4+mm+dd)91 if Isthis_LCuseful(self.STARTDATE, lfile, rfile,logger=logger):92 make_symlink(lfile,jn2r(DEST,"fort.31"),True,logger=logger)93 make_symlink(rfile,jn2r(DEST,"fort.32"),True,logger=logger) 94 else:95 make_symlink(jn2r(self.PARMhwrf,"hwrf_gfdl_loop_current_rmy5.dat"),96 jn2r(DEST,"fort.31"),True,logger=logger)97 make_symlink(jn2r(self.PARMhwrf,"hwrf_gfdl_loop_current_wc_ring_rmy5.dat"),98 jn2r(DEST,"fort.32"),True,logger=logger)99 inpfile(jn2r(DEST,"fort.91"), [mm, dd],logger=logger)100 inpfile(jn2r(DEST,"input_sharp"),["1"],logger=logger)101 inpfile(jn2r(DEST,"input"),102 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)103 except Exception as e:104 msg='Cannot find input: '+str(e)105 logger.warning(msg,exc_info=True)106 raise POMInputError(msg)107 def setrun(self, DEST,logger=None):108 with NamedDir(DEST) as d:109 if logger is None: logger=logging.getLogger('pom')110 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)111 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)112 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)113 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):114 with open('listing','wb') as f:115 listing=str(produtil.listing.Listing())116 f.write(listing)117 produtil.rusage.getrlimit(logger)118 # Raise stack limit to 6000M119 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)120 xc = self.conf.getexe('hwrf_getsst')121 log = jn2r(DEST,"getsst.out")122 with produtil.rusage.rusage(logger=logger):123 retcode = run(openmp(exe(xc),threads=1).env(OMP_STACKSIZE='128M')124 > log,logger=logger)125 logger.info("hwrf_getsst: err = %s" %(retcode))126 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):127 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False)128 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False)129 logger.info("GFS SST extracted: {0}".format(DEST))130 else:131 msg="hwrf_getsst Failed: NO GFS SST extracted: {0}".format(DEST)132 logger.warning(msg)133 raise POMSSTError(msg)134 else: 135 msg="GFS Spectral Files NOT Found in %s:" %(DEST)136 logger.error(msg)137 raise POMInputError(msg)138 if isnonempty('fort.31') and isnonempty('fort.32'):139 rmall(jn2r(DEST,"fort.13"),jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)140 xc = self.conf.getexe('hwrf_sharp_mcs_rf_l2m_rmy5')141 inp = jn2r(DEST,"input_sharp")142 log = jn2r(DEST,"sharp_mcs_r_l2b.out")143 retcode = run((exe(xc) < inp) >= log,logger=logger)144 logger.info("sharp_mcs_rf: err = %s" %(retcode))145 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.13")):146 deliver_file(jn2r(DEST,"fort.13"),jn2r(DEST,"gfdl_initdata.united."+mm),False,logger=logger)147 logger.info("Specified LC penetration: {0}".format(retcode))148 else:149 deliver_file(jn2r(self.FIXhwrf,"gfdl_initdata.gdem.united."+mm), 150 jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)151 logger.warning("sharp_mcs_rf failed: Climate LC penetration %s" %(retcode))152 else:153 deliver_file(jn2r(self.FIXhwrf,"gfdl_initdata.gdem.united."+mm), 154 jn2r(DEST,"gfdl_initdata.united."+mm),logger=logger)155 # Log to highest log level so it is in the jlogfile:156 logger.critical("LC data NOT available: Climate LC penetration %s" %(retcode))157 if os.path.exists(jn2r(DEST,"gfdl_initdata.united."+mm)):158 make_symlink(DEST+"/gfdl_initdata.united."+mm, DEST+"/fort.13",True,logger=logger)159 xc = self.conf.getexe('hwrf_ocean_transatl06prep')160 log = jn2r(DEST,"transatl06prep.out")161 retcode = run(exe(xc) >= log, logger=logger)162 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.113")):163 deliver_file(jn2r(DEST,"fort.113"),jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm),False,logger=logger)164 logger.info("transatl06prep: Success {0}".format(retcode))165 else:166 msg="transatl06prep: Failed {0}".format(retcode)167 logger.warning(msg)168 raise POMPrepError(msg)169 else:170 logger.info("NOT Found in %s:" %("gfdl_initdata.united."+mm)) 171 if os.path.exists(jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm)):172 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)173 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)174 rmall(jn2r(DEST,"fort.13"),logger=logger)175 make_symlink(jn2r(DEST,"gfdl_initdata."+self.DOMAIN+"."+mm),jn2r(DEST,"fort.13"),True,logger=logger)176 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+self.DOMAIN+ 177 ".lores"), jn2r(DEST,"fort.66"),True,logger=logger)178 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])179 inp = jn2r(DEST,"input")180 log = jn2r(DEST,"ocean_pomprep.out")181 retcode = run((exe(xc) < inp ) >= log,logger=logger)182 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):183 logger.info("ocean_pomprep: Success %s:" %(self.ODATA))184 return True185 else:186 msg="ocean_pomprep: Failed %s" %(self.ODATA)187 logger.warning(msg)188 raise POMInitFailed(msg)189 else:190 msg="NOT Found in %s:" %(''.join(["gfdl_initdata.",self.DOMAIN,".",mm]))191 logger.warning(msg)192 raise POMInitFailed(msg)193 194class g3(Oceanini):195 def __init__(self, *args,**kargs):196 super(g3,self).__init__(*args,**kargs)197 def getinp(self, DEST,logger=None):198 if logger is None: logger=logging.getLogger('pom')199 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)200 try:201 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)202 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger)203 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger)204 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+205 self.DOMAIN+".lores"),jn2r(DEST,"fort.66"),True,logger=logger)206 make_symlink(jn2r(self.FIXhwrf,"tgdemv3s"+mm+".nc"),207 jn2r(DEST,"tin.nc"),True,logger=logger)208 make_symlink(jn2r(self.FIXhwrf,"sgdemv3s"+mm+".nc"),209 jn2r(DEST,"sin.nc"),True,logger=logger)210 inpfile(jn2r(DEST,"input"),211 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)212 except Exception as e:213 msg='Input Data does NOT exist: %s'%(str(e),)214 logger.error(msg,exc_info=True)215 raise POMInputError(msg)216 def setrun(self, DEST,logger=None):217 with NamedDir(DEST):218 if logger is None: logger=logging.getLogger('pom')219 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)220 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)221 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)222 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):223 produtil.rusage.getrlimit(logger)224 # Raise stack limit to 6000M225 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)226 xc = self.conf.getexe('hwrf_getsst')227 log = jn2r(DEST,"getsst.out")228 retcode = run(exe(xc).env(OMP_STACKSIZE='128M')229 > log,logger=logger)230 logger.info("hwrf_getsst: err = %s" %(retcode))231 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):232 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False,logger=logger)233 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False,logger=logger)234 logger.info("GFS SST extracted: {0}".format(retcode))235 else:236 msg="hwrf_getsst Failed: NO GFS SST extracted %s" %(retcode)237 logger.warning(msg)238 raise POMSSTError(msg)239 else:240 msg="GFS Spectral Files NOT Found in %s:" %(DEST)241 logger.warning(msg)242 raise POMInputError(msg)243 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)244 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)245 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])246 inp = jn2r(DEST,"input")247 log = jn2r(DEST,"ocean_pomprep.out")248 retcode = run((exe(xc) < inp) > log,logger=logger)249 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):250 logging.info("ocean_pomprep: Success %s:" %(self.ODATA))251 return True252 else:253 msg="ocean_pomprep: Failed %s:" %(self.ODATA)254 logger.warning(msg)255 raise POMInitFailed(msg)256 257class na(Oceanini):258 def __init__(self, *args,**kargs):259 super(na,self).__init__(*args,**kargs)260 def getinp(self, DEST, logger=None):261 if logger is None: logger=logging.getLogger('pom')262 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)263 try:264 # RMY: For now, define local variable "NCDADIR" to point to the NCODA input data #265 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"fort.11"),True,logger=logger)266 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sfcanl"),jn2r(DEST,"for11"),True,logger=logger)267 make_symlink(jn2r(self.GFSDIR,"gfs.t"+hh+"z.sanl"),jn2r(DEST,"fort.12"),True,logger=logger)268 make_symlink(jn2r(self.FIXhwrf,"gfdl_ocean_topo_and_mask."+269 self.DOMAIN+".lores"),jn2r(DEST,"fort.66"),True,logger=logger)270 NCDADIR="/lfs2/projects/hwrf-vd/hwrf-input/NCODA/"+y4+"/"+y4+mm+dd+"/"271 make_symlink(jn2r(NCDADIR,"seatmp_pre_000000_005000_1o2161x1051_"+272 y4+mm+dd+"00_00000000_analfld"),jn2r(DEST,"fort.48"),True,logger=logger)273 make_symlink(jn2r(NCDADIR,"salint_pre_000000_005000_1o2161x1051_"+274 y4+mm+dd+"00_00000000_analfld"),jn2r(DEST,"fort.49"),True,logger=logger)275 make_symlink(jn2r(self.FIXhwrf,"depths_sfc_000000_000000_1o2161x1051_datafld"),276 jn2r(DEST,"fort.68"),True,logger=logger)277 make_symlink(jn2r(self.FIXhwrf,"grdlon_sfc_000000_000000_1o2161x1051_datafld"),278 jn2r(DEST,"fort.78"),True,logger=logger)279 make_symlink(jn2r(self.FIXhwrf,"grdlat_sfc_000000_000000_1o2161x1051_datafld"),280 jn2r(DEST,"fort.79"),True,logger=logger)281 ##################################################################################282 inpfile(jn2r(DEST,"input"), 283 [self.ODATA, "0", str(logi2int(self.SSTASIM)),self.STORMNAME],logger=logger)284 except Exception as e:285 msg='Input data does NOT exist: %s'%(str(e),)286 logger.error(msg,exc_info=True)287 raise POMInputError(msg)288 def setrun(self, DEST,logger=None):289 with NamedDir(DEST):290 if logger is None: logger=logging.getLogger('pom')291 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)292 rmall(jn2r(DEST,"fort.23"),jn2r(DEST,"fort.74"),jn2r(DEST,"fort.77"),logger=logger)293 rmall(jn2r(DEST,"lonlat.gfs"),jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"mask.gfs.dat"),logger=logger)294 if os.path.exists(jn2r(DEST,"fort.11")) and os.path.exists(jn2r(DEST,"fort.12")):295 produtil.rusage.getrlimit(logger)296 # Raise stack limit to 6000M297 produtil.rusage.setrlimit(ignore=True,logger=logger,stack=6e9)298 xc = self.conf.getexe('hwrf_getsst')299 log = jn2r(DEST,"getsst.out")300 retcode = run(exe(xc).env(OMP_STACKSIZE='128M')301 > log,logger=logger)302 logging.info("hwrf_getsst: err = %s" %(retcode))303 if retcode == 0 and os.path.exists(jn2r(DEST,"fort.74")):304 deliver_file(jn2r(DEST,"fort.74"),jn2r(DEST,"sst.gfs.dat"),False,logger=logger)305 deliver_file(jn2r(DEST,"fort.77"),jn2r(DEST,"mask.gfs.dat"),False,logger=logger)306 logger.info("GFS SST extracted: {0}".format(retcode))307 else:308 msg="hwrf_getsst Failed: NO GFS SST extracted %s"%(retcode)309 logger.warning(msg)310 raise POMSSTError(msg)311 else:312 msg="GFS Spectral Files NOT Found in %s:" %(DEST)313 logger.warning(msg)314 raise POMInputError(msg)315 deliver_file(jn2r(DEST,"sst.gfs.dat"),jn2r(DEST,"fort.21"),False,logger=logger)316 deliver_file(jn2r(DEST,"mask.gfs.dat"),jn2r(DEST,"fort.22"),False,logger=logger)317 xc = self.conf.getexe("hwrf_ocean_pomprep_"+self.ODATA[0:2])318 inp = jn2r(DEST,"input")319 log = jn2r(DEST,"ocean_pomprep.out")320 retcode = run((exe(xc) < inp) >log,logger=logger)321 if retcode == 0 and os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")):322 logging.info("ocean_pomprep: Success %s:" %(self.ODATA))323 return True324 else:325 msg="ocean_pomprep: Failed %s:" %(self.ODATA)326 logger.warning(msg)327 raise POMInitFailed(msg)328class phase(Oceanini):329 def __init__(self,*args,**kargs):330 super(phase,self).__init__(*args,**kargs)331 def getinp(self, DEST, logger=None):332 if logger is None: logger=logging.getLogger('pom')333 try:334 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)335 SRC = jn2r(self.CSTREAM, self.ODIR)336 make_symlink(jn2r(SRC,self.STORMNAME+".grid.nc"),337 jn2r(DEST,self.STORMNAME+".grid.nc"),True,logger=logger)338 make_symlink(jn2r(SRC,self.STORMNAME+".ts_initial.nc"),339 jn2r(DEST,self.STORMNAME+".ts_initial.nc"),True,logger=logger)340 make_symlink(jn2r(SRC,self.STORMNAME+".ts_clim.nc"),341 jn2r(DEST,self.STORMNAME+".ts_clim.nc"),True,logger=logger)342 make_symlink(jn2r(SRC,self.STORMNAME+".uv_initial.nc"),343 jn2r(DEST,self.STORMNAME+".uv_initial.nc"),True,logger=logger) 344 make_symlink(jn2r(SRC,self.STORMNAME+".el_initial.nc"),345 jn2r(DEST,self.STORMNAME+".el_initial.nc"),True,logger=logger)346 except Exception as e:347 msg='Input data does not exist: %s'%(str(e),)348 logger.warning(msg,exc_info=True)349 raise POMInputError(msg)350 def setrun(self, DEST,logger=None):351 with NamedDir(DEST):352 if logger is None: logger=logging.getLogger('pom')353 (y4,mm,mm1,dd,hh) = ysplitter(self.STARTDATE)354 if os.path.exists(jn2r(DEST,self.STORMNAME+".grid.nc")) and \355 os.path.exists(jn2r(DEST,"pom.nml")):356 exe = self.conf.getexe("hwrf_ocean_init")357 log = jn2r(DEST,"ocean_init.out")358 retcode=run(mpirun(mpi(exe)*9) >= log ,logger=logger)...

Full Screen

Full Screen

corefs.py

Source:corefs.py Github

copy

Full Screen

...43 'tmp',44 'usr',45 'var',46 )47 corefs.make_symlink('usr/lib64', 'lib')48 corefs.make_symlink('usr/lib64', 'lib64')49 corefs.make_symlink('usr/lib32', 'lib32')50 corefs.make_symlink('usr/bin', 'bin')51 corefs.make_symlink('usr/bin', 'sbin')52 # /media hierarchy53 corefs.make_keepers(54 'media/floppy',55 'media/cdrom',56 'media/cdrecorder',57 'media/zip',58 )59 # /usr hierarchy60 corefs.make_keepers(61 'usr/bin',62 'usr/games',63 'usr/include',64 'usr/lib64',65 'usr/lib32',66 'usr/libexec',67 'usr/local',68 'usr/share',69 'usr/src',70 )71 corefs.make_symlink('lib64', 'usr/lib')72 corefs.make_symlink('bin', 'usr/sbin')73 corefs.make_symlink('../var/tmp', 'usr/tmp')74 # /usr/lib hierarchy75 corefs.make_keepers('usr/lib64/modules')76 # /usr/local hierarchy77 corefs.make_keepers(78 'usr/local/bin',79 'usr/local/etc',80 'usr/local/games',81 'usr/local/include',82 'usr/local/lib64',83 'usr/local/lib32',84 'usr/local/man',85 'usr/local/share',86 'usr/local/src',87 )88 corefs.make_symlink('lib64', 'usr/local/lib')89 corefs.make_symlink('bin', 'usr/local/sbin')90 # /usr/share hierarchy91 corefs.make_keepers(92 'usr/share',93 'usr/src',94 )95 # /var hierarchy96 corefs.make_keepers(97 'var/tmp'98 )99 corefs.make_symlink('../run', 'var/run')100 with stdlib.pushd(corefs.wrap_cache):101 # Change permission of /root, /tmp and /var/tmp102 os.chmod('root', 0o700)103 os.chmod('tmp', 0o1777)104 os.chmod('var/tmp', 0o1777)105 # Write a default etc/passwd106 with open('etc/passwd', 'w+') as passwd:107 passwd.write(dedent('''\108 root:x:0:0:root:/root:/usr/bin/bash109 bin:x:1:1:bin:/dev/null:/usr/bin/false110 daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false111 nobody:x:65534:65534:nobody:/var/empty:/usr/bin/false112 '''))113 # Write a default etc/group...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful