4 Created on Wed Nov 20 15:56:47 EST 2019
12 import multiprocessing
as mp
18 "login" :
"-p 10022 gs616-container103",
19 "initStr" :
"source .bash_profile",
25 "login" :
"analysis701",
26 "initStr" :
"source .profile",
31 "name" :
"macosx_intel",
33 "initStr" :
"source .bash_profile",
34 "exitStr" :
" && fix_mac_rpath.py"
38 "name" :
"macosx_arm64",
40 "initStr" :
"source .zshrc",
47 "initStr" :
"source .bash_profile",
52 firstRunStr =
" && cd \$OCSSWROOT/.. && if [ ! -d ocssw ]; then mkdir ocssw; fi && if [ ! -d ocssw/share ]; then mkdir ocssw/share; fi && if [ ! -d ocssw/testdata ]; then mkdir ocssw/testdata; fi && if [ ! -d ocssw/var ]; then mkdir ocssw/var; fi && if [ ! -d ocssw/opt ]; then mkdir ocssw/opt; fi && if [ ! -d polarimetry ]; then mkdir polarimetry; fi"
53 saveOcsswStr =
" && rm -rf saveOcssw && mkdir saveOcssw && cd ocssw && mv share testdata var ../saveOcssw"
54 restoreOcsswStr =
" && rm -rf share/modis && mv ../saveOcssw/share ../saveOcssw/testdata ../saveOcssw/var ."
55 saveOptStr =
" && mv opt ../saveOcssw"
56 restoreOptStr =
" && mv ../saveOcssw/opt ."
57 getOcsswStr =
" && cd \$OCSSWROOT/.. && rm -rf ocssw && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/obpg/ocssw.git && cd ocssw && source OCSSW_bash.env"
58 getSubmodulesStr =
" && git submodule init && git submodule update"
59 buildOptStr =
" && ./get_lib3_src.sh && cd opt/src && ./BuildIt.py && cd ../.."
60 buildOcsswStr =
" && mkdir build && cd build && cmake .. -DBUILD_ALL=1 && make -j 20 install"
61 getViirsStr =
" && cd \$OCSSWROOT/.. && rm -rf viirs_l1 && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/viirs/viirs_l1.git && cd viirs_l1"
62 buildViirsStr =
" && mkdir build && cd build && cmake .. && make -j 20 install"
63 getFocsStr =
" && cd \$OCSSWROOT/.. && rm -rf focs && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/obpg/focs.git && cd focs"
64 buildFocsStr =
" && mkdir build && cd build && cmake .. && make -j 20 install"
65 getDtdbStr =
" && cd \$OCSSWROOT/.. && rm -rf dtdb && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/aerosol/dtdb.git && cd dtdb"
66 buildDtdbStr =
" && mkdir build && cd build && cmake .. && make -j 20 install"
68 getHarp2Str =
" && cd \$OCSSWROOT/../polarimetry && rm -rf harp && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/polarimetry/harp.git && cd harp"
69 buildHarp2HippStr =
" && cd hipp && mkdir build && cd build && cmake .. && make install && cd .."
71 getL1bcgen_spexoneStr =
" && cd \$OCSSWROOT/../polarimetry && rm -rf spex && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/polarimetry/spex.git && cd spex"
72 buildL1bcgen_spexoneStr =
" && mkdir build && cd build && cmake .. -DCMAKE_EXE_LINKER_FLAGS=\\\"-Wl,-rpath,\\\\\$ORIGIN/../opt/lib -L\$LIB3_DIR/lib -lnetcdf_c++4 -lnetcdf -lhdf5 -llapack -lblas\\\" -DCMAKE_PREFIX_PATH=\$LIB3_DIR -DL1BC_ONLY=1 -DCMAKE_BUILD_TYPE=Release && make -j 20 && cp spexone \$OCSSWROOT/bin/l1bcgen_spexone"
74 getFastmapolStr =
" && cd \$OCSSWROOT/../polarimetry && rm -rf fastmapol && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/polarimetry/fastmapol.git && cd fastmapol"
75 buildFastmapolStr =
" && mkdir build && cd build && cmake .. && make install"
77 getUaaStr =
" && cd \$OCSSWROOT/../sat && rm -rf unified_dtdb_aerosol && git clone https://oceandata.sci.gsfc.nasa.gov/rcs/sat/unified_dtdb_aerosol.git && cd unified_dtdb_aerosol"
78 buildUaaStr =
" && mkdir build && cd build && cmake .. && make install"
81 def doIt(cmd, logFilename):
82 logFile = open(logFilename,
"w")
83 result = subprocess.run(cmd, shell=
True, stderr=subprocess.STDOUT, stdout=logFile)
85 sys.exit(result.returncode)
91 parser = argparse.ArgumentParser(description=
"Build OCSSW on all of our architectures")
92 parser.add_argument(
"-t",
"--tag", default=
None,
93 help=
"git tag or branch that you want to build")
94 parser.add_argument(
"-a",
"--arch", default=
None,
95 help=
"comma separated list of architectures that you want to build (linux_64,linux_hpc,odps,macosx_intel,macosx_arm64)")
96 parser.add_argument(
"--build_opt", default=
False, action=
"store_true",
97 help=
"build opt (lib3) first")
100 args = parser.parse_args()
105 for info
in machineInfo:
106 machineList.append(info[
"name"])
107 archList = args.arch.split(
',')
108 for arch
in archList:
109 if arch
not in machineList:
110 print(
"Architecture", arch,
"is not in the list of supported architectures")
116 for info
in machineInfo:
118 if info[
"name"]
not in args.arch:
122 runList.append(info[
"name"])
123 print(
"\n---making", info[
"name"])
125 commandLine =
"ssh " + info[
"login"] +
' "set -x; ' + info[
"initStr"] + firstRunStr + saveOcsswStr
126 if not args.build_opt:
127 commandLine += saveOptStr
128 commandLine += getOcsswStr
130 commandLine +=
" && git checkout " + args.tag
131 commandLine += getSubmodulesStr
133 commandLine += buildOptStr
135 commandLine += restoreOptStr
136 commandLine += restoreOcsswStr
137 commandLine +=
" && rm -rf ../saveOcssw"
140 commandLine += getViirsStr
142 commandLine +=
" && git checkout " + args.tag
143 commandLine += getSubmodulesStr
144 commandLine += buildViirsStr
148 if (info[
"name"] !=
"macosx_intel")
and (info[
"name"] !=
"macosx_arm64"):
149 commandLine += getFocsStr
151 commandLine +=
" && git checkout " + args.tag
152 commandLine += getSubmodulesStr
153 commandLine += buildFocsStr
156 commandLine += getDtdbStr
158 commandLine +=
" && git checkout " + args.tag
159 commandLine += getSubmodulesStr
160 commandLine += buildDtdbStr
163 commandLine +=
" && cd \$OCSSWROOT"
164 commandLine += buildOcsswStr
167 if info[
"name"] ==
"odps":
169 commandLine += getHarp2Str
171 commandLine +=
" && git checkout " + args.tag
172 commandLine += buildHarp2HippStr
175 commandLine += getFastmapolStr
177 commandLine +=
" && git checkout " + args.tag
178 commandLine += buildFastmapolStr
181 commandLine += getUaaStr
183 commandLine +=
" && git checkout " + args.tag
184 commandLine += buildUaaStr
189 if info[
"name"] ==
"linux_hpc":
191 commandLine += getL1bcgen_spexoneStr
193 commandLine +=
" && git checkout " + args.tag
194 commandLine += buildL1bcgen_spexoneStr
197 commandLine += info[
"exitStr"]
200 logFilename =
"build." + info[
"name"] +
".log"
202 processes.append(mp.Process(target=doIt, name=info[
"name"], args=(commandLine, logFilename)))
205 print(
"Architecture", args.arch,
"is not valid")
208 print(
"Starting Processes")
214 print(
"Waiting for Processes")
220 print(
"Checking results")
227 print(p.name,
"return code =", p.exitcode)
229 print(p.name,
"Success")
233 print(
"Everyting completed successfully.")
239 if __name__ ==
"__main__":