@@ -958,11 +958,11 @@ OpenWrap.oJob.prototype.__addLog = function(aOp, aJobName, aJobExecId, args, anE
958
958
try {
959
959
//var execJob = $path(existing.log, "[?id==`" + currentJobExecId + "`] | @[0]");
960
960
var execJob = $from ( existing . log ) . useCase ( true ) . equals ( "id" , currentJobExecId ) . at ( 0 ) ;
961
- if ( isDef ( anException ) && isDef ( anException . javaException ) ) {
961
+ if ( isDef ( anException ) && isDef ( anException . javaException ) && this . __ojob . logArgs ) {
962
962
var ar = anException . javaException . getStackTrace ( ) ;
963
- execJob . error = [ String ( anException . javaException ) ] ;
964
- for ( var er in ar ) {
965
- execJob . error . push ( " at " + ar [ er ] ) ;
963
+ execJob . error = [ String ( anException . javaException ) ] ;
964
+ for ( var er in ar ) {
965
+ execJob . error . push ( " at " + ar [ er ] ) ;
966
966
}
967
967
} else {
968
968
execJob . error = String ( anException ) ;
@@ -1067,6 +1067,7 @@ OpenWrap.oJob.prototype.__addLog = function(aOp, aJobName, aJobExecId, args, anE
1067
1067
// Housekeeping
1068
1068
while ( existing . log . length > this . __logLimit ) existing . log . shift ( ) ;
1069
1069
1070
+ if ( ! this . __ojob . logArgs ) delete existing . args ;
1070
1071
this . getLogCh ( ) . set ( { "ojobId" : this . __id + aId , "name" : aJobName } , existing ) ;
1071
1072
}
1072
1073
@@ -1514,19 +1515,28 @@ OpenWrap.oJob.prototype.runJob = function(aJob, provideArgs, aId, noAsync, rExec
1514
1515
var useExt = true , recordError = true ;
1515
1516
if ( isDef ( fint ) ) {
1516
1517
if ( ! fint ( aValue , job , id , depInfo , e ) ) {
1517
- errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1518
+ if ( parent . __ojob . logArgs )
1519
+ errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1520
+ else
1521
+ errors . push ( stringify ( { exception : e } ) ) ;
1518
1522
}
1519
1523
recordError = false ;
1520
1524
useExt = false ;
1521
1525
}
1522
1526
if ( isDef ( fe ) && useExt ) {
1523
1527
if ( ! fe ( aValue , job , id , depInfo , e ) ) {
1524
- errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1528
+ if ( parent . __ojob . logArgs )
1529
+ errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1530
+ else
1531
+ errors . push ( stringify ( { exception : e } ) ) ;
1525
1532
}
1526
1533
recordError = false ;
1527
1534
}
1528
1535
if ( recordError ) {
1529
- errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1536
+ if ( parent . __ojob . logArgs )
1537
+ errors . push ( stringify ( { args : aValue , exception : e } ) ) ;
1538
+ else
1539
+ errors . push ( stringify ( { exception : e } ) ) ;
1530
1540
}
1531
1541
} finally {
1532
1542
return true ;
@@ -1542,19 +1552,28 @@ OpenWrap.oJob.prototype.runJob = function(aJob, provideArgs, aId, noAsync, rExec
1542
1552
var useExt = true , recordError = true ;
1543
1553
if ( isDef ( fint ) ) {
1544
1554
if ( ! fint ( args . __oJobRepeat [ aVi ] , job , id , depInfo , e ) ) {
1545
- errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1555
+ if ( parent . __ojob . logArgs )
1556
+ errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1557
+ else
1558
+ errors . push ( stringify ( { exception : e } ) ) ;
1546
1559
}
1547
1560
recordError = false ;
1548
1561
useExt = false ;
1549
1562
}
1550
1563
if ( isDef ( fe ) && useExt ) {
1551
1564
if ( ! fe ( args . __oJobRepeat [ aVi ] , job , id , depInfo , e ) ) {
1552
- errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1565
+ if ( parent . __ojob . logArgs )
1566
+ errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1567
+ else
1568
+ errors . push ( stringify ( { exception : e } ) ) ;
1553
1569
}
1554
1570
recordError = false ;
1555
1571
}
1556
1572
if ( recordError ) {
1557
- errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1573
+ if ( parent . __ojob . logArgs )
1574
+ errors . push ( stringify ( { args : args . __oJobRepeat [ aVi ] , exception : e } ) ) ;
1575
+ else
1576
+ errors . push ( stringify ( { exception : e } ) ) ;
1558
1577
}
1559
1578
}
1560
1579
}
@@ -1892,7 +1911,7 @@ OpenWrap.oJob.prototype.addJob = function(aJobsCh, _aName, _jobDeps, _jobType, _
1892
1911
}
1893
1912
var prefix = "" ;
1894
1913
if ( isString ( aJobTypeArgs . shellPrefix ) ) {
1895
- prefix = ".prefix(\"" + aJobTypeArgs . shellPrefix + "\")" ;
1914
+ prefix = ".prefix(objOrStr(args, \"" + parent . __processTypeArg ( aJobTypeArgs . shellPrefix ) + "\") )" ;
1896
1915
}
1897
1916
res += "var __uuid = '.' + genUUID() + '.bat'; _$(args.ssh, 'ssh').isMap().$_(); var __res = $ssh(args.ssh).putFile(ft, __uuid).sh(" + stringify ( aJobTypeArgs . shell ) + " + ' ' + __uuid)" + prefix + ".exit((r, s)=>s.rm(__uuid)).get(0); io.rm(ft);\n" ;
1898
1917
res += "if (!isNull(__res.stdout)) if (isMap(jsonParse(__res.stdout, true))) { args = merge(args, jsonParse(__res.stdout, true)) } else { if (__res.stdout.length > 0) { printnl(__res.stdout) }; if (__res.stderr.length > 0) { printErrnl(__res.stderr); } }" ;
@@ -1903,7 +1922,7 @@ OpenWrap.oJob.prototype.addJob = function(aJobsCh, _aName, _jobDeps, _jobType, _
1903
1922
if ( ! ( res . indexOf ( "/* __oaf_ojob shell */" ) >= 0 ) ) {
1904
1923
var prefix = "" ;
1905
1924
if ( isString ( aJobTypeArgs . shellPrefix ) ) {
1906
- prefix = ".prefix(\"" + aJobTypeArgs . shellPrefix + "\")" ;
1925
+ prefix = ".prefix(objOrStr(args, \"" + parent . __processTypeArg ( aJobTypeArgs . shellPrefix ) + "\") )" ;
1907
1926
}
1908
1927
if ( ow . format . isWindows ( ) && isUnDef ( aJobTypeArgs . shell ) ) {
1909
1928
var orig = String ( res ) ;
@@ -1951,7 +1970,7 @@ OpenWrap.oJob.prototype.addJob = function(aJobsCh, _aName, _jobDeps, _jobType, _
1951
1970
var orig = String ( res ) ;
1952
1971
var prefix = "" ;
1953
1972
if ( isString ( aJobTypeArgs . shellPrefix ) ) {
1954
- prefix = ".prefix(\"" + aJobTypeArgs . shellPrefix + "\")" ;
1973
+ prefix = ".prefix(objOrStr(args, \"" + parent . __processTypeArg ( aJobTypeArgs . shellPrefix ) + "\") )" ;
1955
1974
}
1956
1975
res = "/* __oaf_ojob shell */ " ;
1957
1976
if ( aJobTypeArgs . noTemplate ) {
@@ -2104,9 +2123,9 @@ OpenWrap.oJob.prototype.addTodo = function(aOJobID, aJobsCh, aTodoCh, aJobName,
2104
2123
2105
2124
/**
2106
2125
* <ojob>
2107
- * <key>ow.oJob.output(aObj, args, aFunc)</key>
2126
+ * <key>ow.oJob.output(aObj, args, aFunc) : Map </key>
2108
2127
* Tries to output aObj in different ways give the args provided. If args.__format or args.__FORMAT is provided it will force
2109
- * displaying values as "json", "yaml", "table", "map", "pm" (on the __pm variable with _list, _map or result) or "human". In "human" it will use the aFunc
2128
+ * displaying values as "json", "prettyjson", "slon", " yaml", "table", "map", "pm" (on the __pm variable with _list, _map or result) or "human". In "human" it will use the aFunc
2110
2129
* provided or a default that tries printMap or sprint. If a format isn't provided it defaults to human or global.__format if defined.
2111
2130
* </ojob>
2112
2131
*/
@@ -2128,6 +2147,12 @@ OpenWrap.oJob.prototype.output = function(aObj, args, aFunc) {
2128
2147
case "json" :
2129
2148
sprint ( aObj , "" ) ;
2130
2149
break ;
2150
+ case "prettyjson" :
2151
+ sprint ( aObj ) ;
2152
+ break ;
2153
+ case "slon" :
2154
+ print ( ow . format . toSLON ( aObj ) ) ;
2155
+ break ;
2131
2156
case "yaml" :
2132
2157
yprint ( aObj ) ;
2133
2158
break ;
0 commit comments