Logger#

class pams.logs.Logger[source]#

Logger class.

Logger is designed to handling parallelized market simulations. In the parallelized simulation, the order that logs are pushed to this logger is not deterministic

because of varied computational time.

For example, there are 2 markets, market 1 and market 2, and those markets are run in parallel,

the computational time of one step for each market are not fixed.

Therefore, the logging sequence of market 1 and market 2 is not always the same. For handling this problem, logger should save the logs from those markets and the end of each step,

the logs are processed and written.

However, for some implementation, non-blocking log writing should be also supported. Therefore, this logger has 2 methods to handling logs – write() and write_and_direct_process()

bulk_write(logs)[source]#

set some logs to pending list.

Parameters:

logs (List[pams.logs.Log]) – log list.

Return type:

None

Returns:

None

bulk_write_and_direct_process(logs)[source]#

direct writing some logs.

Parameters:

logs (List[pams.logs.Log]) – log list.

Return type:

None

Returns:

None

process(logs)[source]#

logging execution. For each log type, each processing method are implemented.

For usual implementation, please use

However, if you want to control the log writing sequence, you can change this implementation.

Parameters:

logs (List[pams.logs.Log]) – log list.

Return type:

None

Returns:

None

process_cancel_log(log)[source]#

process cancel log. Called from process().

Parameters:

log (pams.logs.CancelLog]) – cancel log

Return type:

None

Returns:

None

process_execution_log(log)[source]#

process execution log. Called from process().

Parameters:

log (pams.logs.ExecutionLog]) – execution log

Return type:

None

Returns:

None

process_expiration_log(log)[source]#

process expiration log. Called from process().

Parameters:

log (pams.logs.ExpirationLog]) – expiration log

Return type:

None

Returns:

None

process_market_step_begin_log(log)[source]#

process market step begin log. Called from process().

Parameters:

log (pams.logs.MarketStepBeginLog]) – market step begin log

Return type:

None

Returns:

None

process_market_step_end_log(log)[source]#

process market step end log. Called from process().

Parameters:

log (pams.logs.MarketStepEndLog]) – market step end log

Return type:

None

Returns:

None

process_order_log(log)[source]#

process order log. Called from process().

Parameters:

log (pams.logs.OrderLog]) – order log

Return type:

None

Returns:

None

process_session_begin_log(log)[source]#

process session begin log. Called from process().

Parameters:

log (pams.logs.SessionBeginLog]) – session begin log

Return type:

None

Returns:

None

process_session_end_log(log)[source]#

process session end log. Called from process().

Parameters:

log (pams.logs.SessionEndLog]) – session end log

Return type:

None

Returns:

None

process_simulation_begin_log(log)[source]#

process simulation begin log. Called from process().

Parameters:

log (pams.logs.SimulationBeginLog]) – simulation begin log

Return type:

None

Returns:

None

process_simulation_end_log(log)[source]#

process simulation end log. Called from process().

Parameters:

log (pams.logs.SimulationEndLog]) – simulation end log

Return type:

None

Returns:

None

write(log)[source]#

set a log to pending list.

Parameters:

log (pams.logs.Log) – log.

Return type:

None

Returns:

None

write_and_direct_process(log)[source]#

direct writing a log.

Parameters:

log (pams.logs.Log) – log.

Return type:

None

Returns:

None