Skip to content

Commit

Permalink
Closes Bears-R-Us#2633: Resolve Arkouda deprecation warnings for 1.32…
Browse files Browse the repository at this point in the history
… to date (Bears-R-Us#2632)

* Add IO compat for string casting

* Switch to map.setOrReplace

* Fix %jt warnings

* Replace %t format specifier with %jt

* Update test

* Fix quote stripping for bigint printing

* Fix missing var args formatJson in 130

* Fix make test hang

* Add jsonToTupleCompat

* Add readfCompat function

* Add jsonToPdarray compat

* Add review feedback from Pierce
  • Loading branch information
bmcdonald3 committed Aug 4, 2023
1 parent a6959d6 commit e322904
Show file tree
Hide file tree
Showing 62 changed files with 1,357 additions and 1,183 deletions.
4 changes: 2 additions & 2 deletions METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Measurement metrics are generated in the MeasurementsTable class:
}
proc set(metric: string, measurement: real) {
this.measurements.addOrSet(metric, measurement);
this.measurements.addOrReplace(metric, measurement);
}
```

Expand All @@ -40,7 +40,7 @@ Count metrics are captured in the Counter Table:

```
proc set(metric: string, count: int) {
this.counts.addOrSet(metric,count);
this.counts.addOrReplace(metric,count);
}
proc increment(metric: string, increment: int=1) {
Expand Down
7 changes: 5 additions & 2 deletions arkouda/pdarrayclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ def unescape(s):
dtname, value = msg.split(maxsplit=1)
mydtype = dtype(dtname)
if mydtype == bigint:
# we have to strip off quotes
return int(value[1:-1])
# we have to strip off quotes prior to 1.32
if value[0] == "\"":
return int(value[1:-1])
else:
return int(value)
if mydtype == npbool:
if value == "True":
return mydtype.type(True)
Expand Down
14 changes: 7 additions & 7 deletions src/ArgSortMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ module ArgSortMsg
deltaIV = argsortDefault(newa);
}
otherwise { throw getErrorWithContext(
msg="Unsupported DataType: %t".format(dtype2str(g.dtype)),
msg="Unsupported DataType: %?".doFormat(dtype2str(g.dtype)),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand Down Expand Up @@ -218,7 +218,7 @@ module ArgSortMsg
algorithm = algoName: SortingAlgorithm;
} catch {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".format(algoName),
msg="Unrecognized sorting algorithm: %s".doFormat(algoName),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -230,7 +230,7 @@ module ArgSortMsg
var arrNames = msgArgs.get("arr_names").getList(n);
var arrTypes = msgArgs.get("arr_types").getList(n);
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"number of arrays: %i arrNames: %t, arrTypes: %t".format(n,arrNames, arrTypes));
"number of arrays: %i arrNames: %?, arrTypes: %?".doFormat(n,arrNames, arrTypes));
var (arrSize, hasStr, names, types) = validateArraysSameLength(n, arrNames, arrTypes, st);

// If there were no string arrays, merge the arrays into a single array and sort
Expand Down Expand Up @@ -311,7 +311,7 @@ module ArgSortMsg
}
otherwise {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".format(algorithm:string),
msg="Unrecognized sorting algorithm: %s".doFormat(algorithm:string),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -320,7 +320,7 @@ module ArgSortMsg
}
}
try! asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"argsort time = %i".format(Time.timeSinceEpoch().totalSeconds() - t1));
"argsort time = %i".doFormat(Time.timeSinceEpoch().totalSeconds() - t1));
return iv;
}

Expand All @@ -336,7 +336,7 @@ module ArgSortMsg
algorithm = algoName: SortingAlgorithm;
} catch {
throw getErrorWithContext(
msg="Unrecognized sorting algorithm: %s".format(algoName),
msg="Unrecognized sorting algorithm: %s".doFormat(algoName),
lineNumber=getLineNumber(),
routineName=getRoutineName(),
moduleName=getModuleName(),
Expand All @@ -347,7 +347,7 @@ module ArgSortMsg
// get next symbol name
var ivname = st.nextName();
asLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"cmd: %s name: %s ivname: %s".format(cmd, name, ivname));
"cmd: %s name: %s ivname: %s".doFormat(cmd, name, ivname));

var objtype = msgArgs.getValueOf("objType").toUpper(): ObjType;
select objtype {
Expand Down
12 changes: 6 additions & 6 deletions src/AryUtil.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ module AryUtil
*/
proc formatAry(A):string throws {
if A.size <= printThresh {
return "%t".format(A);
return "%?".doFormat(A);
} else {
return "%t ... %t".format(A[A.domain.low..A.domain.low+2],
return "%? ... %?".doFormat(A[A.domain.low..A.domain.low+2],
A[A.domain.high-2..A.domain.high]);
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ module AryUtil
proc validateArraysSameLength(n:int, names:[] string, types: [] string, st: borrowed SymTab) throws {
// Check that fields contains the stated number of arrays
if (names.size != n) {
var errorMsg = "Expected %i arrays but got %i".format(n, names.size);
var errorMsg = "Expected %i arrays but got %i".doFormat(n, names.size);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand All @@ -155,7 +155,7 @@ module AryUtil
"ArgumentError");
}
if (types.size != n) {
var errorMsg = "Expected %i types but got %i".format(n, types.size);
var errorMsg = "Expected %i types but got %i".doFormat(n, types.size);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand Down Expand Up @@ -201,7 +201,7 @@ module AryUtil
thisSize = segs.size;
}
otherwise {
var errorMsg = "Unrecognized object type: %s".format(objtype);
var errorMsg = "Unrecognized object type: %s".doFormat(objtype);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand All @@ -215,7 +215,7 @@ module AryUtil
size = thisSize;
} else {
if (thisSize != size) {
var errorMsg = "Arrays must all be same size; expected size %t, got size %t".format(size, thisSize);
var errorMsg = "Arrays must all be same size; expected size %?, got size %?".doFormat(size, thisSize);
auLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg);
throw new owned ErrorWithContext(errorMsg,
getLineNumber(),
Expand Down
10 changes: 5 additions & 5 deletions src/BigIntMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module BigIntMsg {
use List;

use ArkoudaListCompat;

use ArkoudaIOCompat;

private config const logLevel = ServerConfig.logLevel;
private config const logChannel = ServerConfig.logChannel;
Expand Down Expand Up @@ -50,7 +50,7 @@ module BigIntMsg {
var retname = st.nextName();
st.addEntry(retname, new shared SymEntry(bigIntArray, max_bits));
var syment = toSymEntry(getGenericTypedArrayEntry(retname, st), bigint);
repMsg = "created %s".format(st.attrib(retname));
repMsg = "created %s".doFormat(st.attrib(retname));
biLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),repMsg);
return new MsgTuple(repMsg, MsgType.NORMAL);
}
Expand All @@ -74,15 +74,15 @@ module BigIntMsg {
low = tmp:uint;
var retname = st.nextName();
st.addEntry(retname, new shared SymEntry(low));
retList.pushBack("created %s".format(st.attrib(retname)));
retList.pushBack("created %s".doFormat(st.attrib(retname)));

all_zero = true;
forall t in tmp with (&& reduce all_zero) {
t >>= ushift;
all_zero &&= (t == 0 || t == -1);
}
}
var repMsg = "%jt".format(retList);
var repMsg = formatJson(retList);
biLogger.debug(getModuleName(), getRoutineName(), getLineNumber(), repMsg);
return new MsgTuple(repMsg, MsgType.NORMAL);
}
Expand All @@ -101,7 +101,7 @@ module BigIntMsg {

select gEnt.dtype {
when DType.BigInt {
var repMsg = "%jt".format(toSymEntry(gEnt, bigint).max_bits);
var repMsg = formatJson(toSymEntry(gEnt, bigint).max_bits);
biLogger.debug(getModuleName(), getRoutineName(), getLineNumber(), repMsg);
return new MsgTuple(repMsg, MsgType.NORMAL);
}
Expand Down
Loading

0 comments on commit e322904

Please sign in to comment.