Skip to content

Commit

Permalink
Merge pull request #212 from mhmerrill/split-out-logging
Browse files Browse the repository at this point in the history
Split out logging and new version number
  • Loading branch information
reuster986 authored Dec 10, 2019
2 parents 9b195d4 + aa6280a commit e8a97bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ By default, the server listens on port `5555` and prints verbose output. These o

Memory checking is turned off by default and turned on by using `--memTrack=true`

Logging messaged are independently controlled be the `--logging=[true|false]` is on by default

Verbose debug messages are independently controlled by `--v=[true|false]` is on by default

## Testing arkouda_server

There is a small test program that connects to a running arkouda_server, runs a few computations, and disconnects from the server. To run it, open a new terminal window in the arkouda directory and run
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2019.11.12
2019.12.10
7 changes: 6 additions & 1 deletion src/ServerConfig.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ module ServerConfig
public use IO;

use ServerErrorStrings;

/*
Logging flag
*/
config const logging = true;

/*
Verbose flag
Verbose debug flag
*/
config const v = true;

Expand Down
12 changes: 6 additions & 6 deletions src/arkouda_server.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ proc main() {

// shutdown server
if reqMsg == "shutdown" {
if v {writeln("reqMsg: ", reqMsg); try! stdout.flush();}
if logging {writeln("reqMsg: ", reqMsg); try! stdout.flush();}
shutdownServer = true;
repCount += 1;
socket.send("shutdown server (%i req)".format(repCount));
Expand All @@ -61,7 +61,7 @@ proc main() {
var cmd = fields[1];
var s0 = t1.elapsed();

if v {
if (logging) {
if cmd == "array" { // has binary data in it's payload
writeln("reqMsg: ", cmd, " <binary-data>");
}
Expand Down Expand Up @@ -139,7 +139,7 @@ proc main() {
repMsg = "disconnected from arkouda server tcp://*:%t".format(ServerPort);
}
otherwise {
if v {writeln("Error: unrecognized command: %s".format(reqMsg)); try! stdout.flush();}
if (logging) {writeln("Error: unrecognized command: %s".format(reqMsg)); try! stdout.flush();}
}
}
} catch (e: ErrorWithMsg) {
Expand All @@ -151,7 +151,7 @@ proc main() {
// send responses
// send count for now
repCount += 1;
if v {
if (logging) {
if cmd == "tondarray" {
writeln("repMsg:"," <binary-data>");
} else {
Expand All @@ -161,10 +161,10 @@ proc main() {
}
socket.send(repMsg);

if (memTrack) {writeln("bytes of memoryUsed() = ",memoryUsed()); try! stdout.flush();}
if (logging && memTrack) {writeln("bytes of memoryUsed() = ",memoryUsed()); try! stdout.flush();}

// end timer for command processing
if v{writeln("<<< %s took %.17r sec".format(cmd, t1.elapsed() - s0)); try! stdout.flush();}
if (logging) {writeln("<<< %s took %.17r sec".format(cmd, t1.elapsed() - s0)); try! stdout.flush();}
}
t1.stop();

Expand Down

0 comments on commit e8a97bc

Please sign in to comment.