@@ -20,6 +20,7 @@ |
import java.text.NumberFormat; |
import java.util.*; |
import java.util.logging.Level; |
+import java.util.logging.Logger; |
import javax.ws.rs.Path; |
import man2weps.WepsTranslator; |
import man2weps.mcrew.ManageData; |
@@ -52,7 +53,6 @@ |
@Resource(type = EXECUTABLE, file = "/bin/${arch}/cligen.exe", id = CLIGEN) |
@Resource(type = FILE, file = "/data/upd_US_cligen_stations.par", id = STATION_PAR) |
|
- |
// windgen |
@Resource(type = EXECUTABLE, file = "/bin/win-x86/wind_gen4.exe", wine = true, id = WINDGEN) |
@Resource(type = EXECUTABLE, file = "/bin/${arch}/interpolate.exe", id = INTERPOLATE) |
@@ -112,9 +112,10 @@ |
public void preProcess() throws Exception { |
|
// required parameter - at least one of these must exist! |
- if (!(JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_SOIL)) && |
- !(JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_SOIL_FILE))) |
+ if (!(JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_SOIL)) |
+ && !(JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_SOIL_FILE))) { |
throw new ServiceException("No Value for " + WEPS_KEY_SOIL + " and " + WEPS_KEY_SOIL_FILE + ". At least one is required."); |
+ } |
|
// At least one of the two soil params must be populated |
// This version is used by IET |
@@ -215,7 +216,29 @@ |
// Z50 is required with calibration flag |
exe.addArguments("-C15", "-Z50"); |
} |
+ |
stdout = exe.stdout(); |
+ |
+ boolean handleProgress = Config.getBoolean("weps.progress", false); |
+ if (handleProgress) { |
+ exe.setStdoutHandler(new Executable.StdHandler() { |
+ @Override |
+ public void handle(String out) { |
+ if (out == null) |
+ return; |
+ int idx = out.lastIndexOf("Year"); |
+ if (idx > -1) { |
+ try { |
+ String a = out.substring(idx, out.indexOf('\n', idx)); |
+ setProgress(a); |
+ } catch (ServiceException ex) { |
+ System.out.println("Error setting progress info."); |
+ } |
+ } |
+ } |
+ }); |
+ } |
+ |
int result = exe.exec(); |
if (result != 0) { |
throw new ServiceException("WEPS exit error :" + result); |
@@ -242,10 +265,7 @@ |
// putResult(new File(getWorkspaceDir(), WEPS_EXE + "-stdout.txt")); |
// putResult(new File(getWorkspaceDir(), WEPS_EXE + "-stderr.txt")); |
// } |
- |
///////////////////////////////////////////////////////////////////////////// |
- |
- |
/* |
*/ |
private String loadWepsMgmt() throws ServiceException { |
@@ -549,7 +569,6 @@ |
// pcInterpolate.exe = "./interpolate.sh"; |
// pcInterpolate.args = new String[]{}; |
// pcInterpolate.execute(); |
- |
String dbpath = getResourceFile(WINDGEN_IDX).toString(); |
String polygon = getResourceFile(BOUNDARY_POL).toString(); |
|
@@ -914,7 +933,7 @@ |
// Load the file data. |
LOG.info("WorkingDir: " + getWorkspaceDir().toString()); |
//reportdata.loadFiles(getWorkspaceDir().toString()); |
- reportdata.loadFiles(getWorkspaceDir().toString(),stdout.getName()); |
+ reportdata.loadFiles(getWorkspaceDir().toString(), stdout.getName()); |
|
// // Dump the loaded data as text for debugging purposes. |
// LOG.info("hash map output=" + con.toString()); |
@@ -927,7 +946,7 @@ |
//LOG.info("COMPARISON for scalars: itemname='" + itemName + "'"); |
//if (itemName.length() >= 5) LOG.info("COMPARISON for scalars: itemname 0,5='" + itemName.substring(0,5) + "'"); |
//if (itemName.length() >= 11) LOG.info("COMPARISON for scalars: itemname 0,11='" + itemName.substring(0,11) + "'"); |
- LOG.info("Trying report value: "+ itemName); |
+ LOG.info("Trying report value: " + itemName); |
if ((itemName != null) && ((((itemName.length()) >= 5) && (itemName.substring(0, 5).contentEquals("runs."))) |
|| (((itemName.length()) >= 11) && (itemName.substring(0, 11).contentEquals("sci_energy."))))) { |
// Scalar values |
@@ -935,7 +954,7 @@ |
ArrayList<Object> scalar = m_reportdata.get(itemName); |
if (scalar != null) { |
//LOG.info("putting to jsonobj=" + scalar.get(0)); |
- LOG.info("Scalar value: "+ scalar.get(0)); |
+ LOG.info("Scalar value: " + scalar.get(0)); |
obj.put(REPORT_VALUE, scalar.get(0)); |
reportItems.put(i, obj); |
} else { |
@@ -1001,7 +1020,7 @@ |
LOG.info("WorkingDir: " + getWorkspaceDir().toString()); |
|
//reportdata.loadFiles(getWorkspaceDir().toString()); |
- reportdata.loadFiles(getWorkspaceDir().toString(),stdout.getName()); |
+ reportdata.loadFiles(getWorkspaceDir().toString(), stdout.getName()); |
|
// // Dump the loaded data as text for debugging purposes. |
// LOG.info("hash map output=" + con.toString()); |
@@ -1,5 +1,5 @@ |
{ |
- "csip-erosion.version": "$version: 0.0.0 xxxxxxx date, built at 2016-10-10 11:30 by Brad$", |
+ "csip-erosion.version": "$version: 1.0.14 35013fa03d75 2016-09-30 od, built at 2016-10-04 12:21 by od$", |
"weps.version" : "1.3.9", |
"lmod.db": "jdbc:sqlserver:\/\/129.82.20.242:1433;databaseName=lmod_zedx;user=lmod-rw;password=managements", |
"conservation_resources.db": "jdbc:sqlserver://129.82.20.241:1433;databaseName=conservation_resources;user=sa;password=csurams#1", |
@@ -19,5 +19,5 @@ |
"csip.logging.keepsevere": "false", |
"csip.accesslog.backend": "none", |
"csip.accesslog.postgres.url": "jdbc:postgresql://192.168.10.110:5432/csiplog?user=postgres", |
- "csip.timezone": "MST7MDT", |
+ "csip.timezone": "MST7MDT" |
} |
@@ -1,5 +1,9 @@ |
{ |
- "csip-erosion.version": "$version: 0.2.128 e3120eb4754f 2016-08-11 Shaun Case, built at 2016-08-11 11:34 by brad$", |
+<<<<<<< local |
+ "csip-erosion.version": "$version: 0.0.0 xxxxxxx date, built at 2016-10-10 11:30 by Brad$", |
+======= |
+ "csip-erosion.version": "$version: 1.0.14 35013fa03d75 2016-09-30 od, built at 2016-10-04 12:21 by od$", |
+>>>>>>> other |
"weps.version" : "1.3.9", |
"lmod.db": "jdbc:sqlserver:\/\/129.82.20.242:1433;databaseName=lmod_zedx;user=lmod-rw;password=managements", |
"conservation_resources.db": "jdbc:sqlserver://129.82.20.241:1433;databaseName=conservation_resources;user=sa;password=csurams#1", |
@@ -10,24 +14,14 @@ |
"csip.session.ttl": "PT300S", |
"csip.session.ttl.failed": "PT3000S", |
"csip.session.mongodb.uri": "mongodb://localhost:27017/csip", |
- "csip.archive.enabled" : "false", |
- "csip.archive.backend": "mongodb", |
+ "csip.archive.backend": "none", |
"csip.archive.mongodb.uri": "mongodb://localhost:27017/csip", |
"csip.archive.ttl": "P7D", |
- "csip.logging.enabled" : "false", |
- "csip.logging.backend": "mongodb", |
+ "csip.logging.backend": "none", |
"csip.logging.level": "INFO", |
"csip.logging.mongodb.uri": "mongodb://localhost:27017/csip", |
"csip.logging.keepsevere": "false", |
- "csip.accesslog.backend": "postgres", |
- "csip.accesslog.enabled": "false", |
+ "csip.accesslog.backend": "none", |
"csip.accesslog.postgres.url": "jdbc:postgresql://192.168.10.110:5432/csiplog?user=postgres", |
- "csip.bin.dir": "/tmp/csip/bin", |
- "csip.cache.dir": "/tmp/csip/cache", |
- "csip.dir": "/tmp/csip", |
- "csip.results.dir": "/tmp/csip/results", |
- "csip.work.dir": "/tmp/csip/work", |
- "csip.data.dir" : "/data", |
- "csip.timezone": "MST7MDT", |
- "csip.keepworkspace":"false" |
+ "csip.timezone": "MST7MDT" |
} |