Skip to content

Commit

Permalink
Merging on to public master
Browse files Browse the repository at this point in the history
  • Loading branch information
davebyrd committed Sep 23, 2020
1 parent ff302ad commit d48da61
Show file tree
Hide file tree
Showing 7 changed files with 992 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ cache/
local/
log/
.idea/
results/
util/crypto/datasets
venv/
.idea/
.ipynb/
.ipynb_checkpoints/
.ipynb_checkpoints/
13 changes: 12 additions & 1 deletion Kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, kernel_name, random_state = None):
def runner(self, agents = [], startTime = None, stopTime = None,
num_simulations = 1, defaultComputationDelay = 1,
defaultLatency = 1, agentLatency = None, latencyNoise = [ 1.0 ],
agentLatencyModel = None,
agentLatencyModel = None, skip_log = False,
seed = None, oracle = None, log_dir = None):

# agents must be a list of agents for the simulation,
Expand All @@ -73,6 +73,9 @@ def runner(self, agents = [], startTime = None, stopTime = None,
# The global seed, NOT used for anything agent-related.
self.seed = seed

# Should the Kernel skip writing agent logs?
self.skip_log = skip_log

# The data oracle for this simulation, if needed.
self.oracle = oracle

Expand Down Expand Up @@ -299,6 +302,12 @@ def runner(self, agents = [], startTime = None, stopTime = None,
ttl_messages / (eventQueueWallClockElapsed / (np.timedelta64(1, 's')))))
log_print ("Ending sim {}", sim)


# The Kernel adds a handful of custom state results for all simulations,
# which configurations may use, print, log, or discard.
self.custom_state['kernel_event_queue_elapsed_wallclock'] = eventQueueWallClockElapsed
self.custom_state['kernel_slowest_agent_finish_time'] = max(self.agentCurrentTimes)

# Agents will request the Kernel to serialize their agent logs, usually
# during kernelTerminating, but the Kernel must write out the summary
# log itself.
Expand Down Expand Up @@ -488,6 +497,8 @@ def writeLog (self, sender, dfLog, filename=None):
# the Kernel will construct a filename based on the name of the Agent
# requesting log archival.

if self.skip_log: return

path = os.path.join(".", "log", self.log_dir)

if filename:
Expand Down
Loading

0 comments on commit d48da61

Please sign in to comment.