Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,28 @@ connect without specifying the token via the access_token parameter or token url
<a id="log-ak"></a>
## Logging <sup><sup><sub><a href="#toc">toc</a></sub></sup></sup>

The Arkouda server features a Chapel logging framework that prints out the module name, routine name and line number
for all logged messages. Available logging levels are ERROR, CRITICAL, WARN, INFO, and DEBUG.
The Arkouda server features a Chapel logging framework that prints out the module name, function name and line number
for all logged messages. An example is shown below:

The default logging level is INFO where all messages at the ERROR, CRITICAL, WARN, and INFO levels are printed. For debugging,
the DEBUG level is enabled by passing in the --v flag upon arkouda\_server startup.
```
2021-04-15:06:22:59 [ConcatenateMsg] concatenateMsg Line 193 DEBUG [Chapel] creating pdarray id_4 of type Int64
2021-04-15:06:22:59 [ServerConfig] overMemLimit Line 175 INFO [Chapel] memory high watermark = 44720 memory limit = 30923764531
2021-04-15:06:22:59 [MultiTypeSymbolTable] addEntry Line 127 DEBUG [Chapel] adding symbol: id_4
```

Available logging levels are ERROR, CRITICAL, WARN, INFO, and DEBUG. The default logging level is INFO where all messages at the ERROR, CRITICAL, WARN, and INFO levels are printed. The log level can be set globally by passing in the --logLevel parameter upon arkouda\_server startup. For example, passing the --logLevel=LogLevel.DEBUG parameter as shown below sets the global log level to DEBUG:

```
./arkouda_server --logLevel=LogLevel.DEBUG
```

In addition to setting the global logging level, the logging level for individual Arkouda modules can also be configured. For example, to set MsgProcessing to DEBUG for the purposes of debugging Arkouda array creation, pass the MsgProcessing.logLevel=LogLevel.DEBUG parameter upon arkouda\_server startup as shown below:

```
./arkouda_server --MsgProcessing.logLevel=LogLevel.DEBUG --logLevel=LogLevel.WARN
```

In this example, the logging level for all other Arkouda modules will be set to the global value WARN.

<a id="typecheck-ak"></a>
## Type Checking in Arkouda <sup><sup><sub><a href="#toc">toc</a></sub></sup></sup>
Expand Down
9 changes: 2 additions & 7 deletions src/ArgSortMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ module ArgSortMsg
use Logging;
use Message;

const asLogger = new Logger();
private config const logLevel = ServerConfig.logLevel;
const asLogger = new Logger(logLevel);

if v {
asLogger.level = LogLevel.DEBUG;
} else {
asLogger.level = LogLevel.INFO;
}

// thresholds for different sized sorts
var lgSmall = 10;
var small = 2**lgSmall;
Expand Down
10 changes: 3 additions & 7 deletions src/ArraySetopsMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ module ArraySetopsMsg
use Errors;
use Logging;
use Message;

var asLogger = new Logger();
if v {
asLogger.level = LogLevel.DEBUG;
} else {
asLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const asLogger = new Logger(logLevel);

/*
Parse, execute, and respond to a intersect1d message
Expand Down
8 changes: 2 additions & 6 deletions src/AryUtil.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ module AryUtil
use Logging;
use ServerConfig;

const auLogger = new Logger();
if v {
auLogger.level = LogLevel.DEBUG;
} else {
auLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const auLogger = new Logger(logLevel);

/*
Threshold for the amount of data that will be printed.
Expand Down
11 changes: 3 additions & 8 deletions src/BroadcastMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ module BroadcastMsg {
use ServerConfig;
use Logging;
use Message;

const bmLogger = new Logger();

if v {
bmLogger.level = LogLevel.DEBUG;
} else {
bmLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const bmLogger = new Logger(logLevel);

/*
* Broadcast a value per segment of a segmented array to the
* full size of the array, optionally applying a permutation
Expand Down
8 changes: 2 additions & 6 deletions src/CastMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ module CastMsg {
use ServerConfig;
use CommAggregation;

const castLogger = new Logger();
if v {
castLogger.level = LogLevel.DEBUG;
} else {
castLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const castLogger = new Logger(logLevel);

proc castMsg(cmd: string, payload: string, st: borrowed SymTab): MsgTuple throws {
use ServerConfig; // for string.splitMsgToTuple
Expand Down
10 changes: 3 additions & 7 deletions src/ConcatenateMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ module ConcatenateMsg
use PrivateDist;

use AryUtil;

const cmLogger = new Logger();
if v {
cmLogger.level = LogLevel.DEBUG;
} else {
cmLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const cmLogger = new Logger(logLevel);

/* Concatenate a list of arrays together
to form one array
Expand Down
9 changes: 2 additions & 7 deletions src/EfuncMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ module EfuncMsg
use ServerErrorStrings;

use AryUtil;

const eLogger = new Logger();

if v {
eLogger.level = LogLevel.DEBUG;
} else {
eLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const eLogger = new Logger(logLevel);

/* These ops are functions which take an array and produce an array.

Expand Down
8 changes: 2 additions & 6 deletions src/FindSegmentsMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ module FindSegmentsMsg
use PrivateDist;
use CommAggregation;

const fsLogger = new Logger();
if v {
fsLogger.level = LogLevel.DEBUG;
} else {
fsLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const fsLogger = new Logger(logLevel);

/*

Expand Down
10 changes: 2 additions & 8 deletions src/FlattenMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ module FlattenMsg {
use Logging;
use Message;

const fmLogger = new Logger();

if v {
fmLogger.level = LogLevel.DEBUG;
} else {
fmLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const fmLogger = new Logger(logLevel);

proc segFlattenMsg(cmd: string, payload: string, st: borrowed SymTab): MsgTuple throws {
var (name, objtype, returnSegsStr, delimJson) = payload.splitMsgToTuple(4);
Expand Down
9 changes: 2 additions & 7 deletions src/GenSymIO.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ module GenSymIO {
use Message;
use ServerConfig;

const gsLogger = new Logger();

if v {
gsLogger.level = LogLevel.DEBUG;
} else {
gsLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const gsLogger = new Logger(logLevel);

config const GenSymIO_DEBUG = false;
config const SEGARRAY_OFFSET_NAME = "segments";
Expand Down
12 changes: 4 additions & 8 deletions src/Histogram.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ module Histogram
use SymArrayDmap;
use Logging;
use Reflection;

const hgLogger = new Logger();
if v {
hgLogger.level = LogLevel.DEBUG;
} else {
hgLogger.level = LogLevel.INFO;
}


private config const logLevel = ServerConfig.logLevel;
const hgLogger = new Logger(logLevel);

/*
Takes the data in array a, creates an atomic histogram in parallel,
and copies the result of the histogram operation into a distributed int array
Expand Down
10 changes: 3 additions & 7 deletions src/HistogramMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ module HistogramMsg
use ServerErrorStrings;

use Histogram;

const hgmLogger = new Logger();
if v {
hgmLogger.level = LogLevel.DEBUG;
} else {
hgmLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const hgmLogger = new Logger(logLevel);

private config const sBound = 2**12;
private config const mBound = 2**25;
Expand Down
18 changes: 7 additions & 11 deletions src/In1d.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ module In1d

use PrivateDist;
use Logging;

var inLogger = new Logger();
if v {
inLogger.level = LogLevel.DEBUG;
} else {
inLogger.level = LogLevel.INFO;
}

private config const logLevel = ServerConfig.logLevel;
const inLogger = new Logger(logLevel);

/* Brute force:
forward-way reduction per element of ar1 over ar2.
Expand Down Expand Up @@ -93,23 +89,23 @@ module In1d

var t = new Time.Timer();

if v {t.start();}
if logLevel == LogLevel.DEBUG {t.start();}

var ar2Set: domain(int, parSafe=false); // create a set to hold ar2, parSafe modification is OFF
ar2Set.requestCapacity(ar2.size); // request a capacity for the initial set

if v {t.stop(); timings[here.id][0] = t.elapsed(); t.clear(); t.start();}
if logLevel == LogLevel.DEBUG {t.stop(); timings[here.id][0] = t.elapsed(); t.clear(); t.start();}

// serially add all elements of ar2 to ar2Set
for e in ar2 { ar2Set += e; }
// all elements of ar2 have been added to ar2Set so modification done.

if v {t.stop(); timings[here.id][1] = t.elapsed(); t.clear(); t.start();}
if logLevel == LogLevel.DEBUG {t.stop(); timings[here.id][1] = t.elapsed(); t.clear(); t.start();}

// in parallel check all elements of ar1 to see if ar2Set contains them
[i in truth.localSubdomain()] truth[i] = ar2Set.contains(ar1[i]);

if v {t.stop(); timings[here.id][2] = t.elapsed();}
if logLevel == LogLevel.DEBUG {t.stop(); timings[here.id][2] = t.elapsed();}
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/In1dMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ module In1dMsg

use In1d;

var iLogger = new Logger();
if v {
iLogger.level = LogLevel.DEBUG;
} else {
iLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const iLogger = new Logger(logLevel);

/*
Small bound const. Brute force in1d implementation recommended.
Expand Down
11 changes: 3 additions & 8 deletions src/IndexingMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ module IndexingMsg
use MultiTypeSymbolTable;

use CommAggregation;

const imLogger = new Logger();

if v {
imLogger.level = LogLevel.DEBUG;
} else {
imLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const imLogger = new Logger(logLevel);

/* intIndex "a[int]" response to __getitem__(int) */
proc intIndexMsg(cmd: string, payload: string, st: borrowed SymTab): MsgTuple throws {
Expand Down Expand Up @@ -427,7 +422,7 @@ module IndexingMsg
var gIV: borrowed GenSymEntry = st.lookup(iname);
var gY: borrowed GenSymEntry = st.lookup(yname);

if v {
if logLevel == LogLevel.DEBUG {
imLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),
"cmd: %s gX: %t gIV: %t gY: %t".format(
cmd, st.attrib(name), st.attrib(iname),
Expand Down
13 changes: 4 additions & 9 deletions src/JoinEqWithDTMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ module JoinEqWithDTMsg
param TRUE_DT = 0;
param ABS_DT = 1;
param POS_DT = 2;

const jeLogger = new Logger();

if v {
jeLogger.level = LogLevel.DEBUG;
} else {
jeLogger.level = LogLevel.INFO;
}


private config const logLevel = ServerConfig.logLevel;
const jeLogger = new Logger(logLevel);

// operator overloads so + reduce and + scan can work on atomic int arrays
proc +(x: atomic int, y: atomic int) {
return x.read() + y.read();
Expand Down
9 changes: 2 additions & 7 deletions src/KExtremeMsg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ module KExtremeMsg
use RadixSortLSD;
use ArraySetopsMsg;

const keLogger = new Logger();

if v {
keLogger.level = LogLevel.DEBUG;
} else {
keLogger.level = LogLevel.INFO;
}
private config const logLevel = ServerConfig.logLevel;
const keLogger = new Logger(logLevel);

/*
Parse, execute, and respond to a mink message
Expand Down
10 changes: 9 additions & 1 deletion src/Logging.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Logging {
use Set;
use IO;
use DateTime;
use Reflection;
use Errors;

/*
* The LogLevel enum is used to provide a strongly-typed means of
Expand All @@ -14,7 +16,7 @@ module Logging {
* of logging sensitivity analogous to other languages such as Python.
*/
class Logger {
var level = LogLevel.WARN;
var level: LogLevel = LogLevel.INFO;

var warnLevels = new set(LogLevel,[LogLevel.WARN, LogLevel.INFO,
LogLevel.DEBUG]);
Expand All @@ -29,6 +31,12 @@ module Logging {

var printDate: bool = true;

proc init(logLevel : LogLevel) {
level = logLevel;
}

proc init() {}

proc debug(moduleName, routineName, lineNumber, msg: string) throws {
if level == LogLevel.DEBUG {
writeln(generateLogMessage(moduleName, routineName, lineNumber,
Expand Down
Loading