Hierarchical context-logging
Implement proper hierarchical context-logging. In principle, logs now appear as follows:
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 INFO werkzeug 5527 _internal.py:88 - 127.0.0.1 - - [22/Jul/2019 11:17:42] "POST /v1/EM1/runs HTTP/1.1" 202 -
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.task 5550 task.py:57 - [2949666a-e88f-4556-aa5e-52431d2a1291] Executing <Model(name=EM1)> (args=2949666a-e88f-4556-aa5e-52431d2a1291, kwargs={}) ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:56 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Running model ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:57 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing input parameters ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:59 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing seismic catalog ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:63 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Received seismic catalog with 1 event(s).
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:65 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing borehole ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:70 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Received borehole (3 hydraulic sample(s)).
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:75 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing scenario ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:81 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Received injection plan with 1 sample(s).
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:87 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing model specific configuration ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:95 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Received model configuration: ChainMap(OrderedDict([('starttime', datetime.datetime(2019, 5, 3, 12, 27, 9, 117623)), ('endtime', datetime.datetime(2019, 5, 3, 15, 27, 9, 117620)), ('bin_duration', 10.0), ('training_duration', 10.0)]), {'local_srs': '', 'const_dim_voxel': [200, 200, 400], 'training_duration': 8.0, 'training_num_kernels': 1000, 'fc_threshold_magnitude': 4.5, 'fc_cumulative_injected_volume': 0})
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:97 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] Importing reservoir geometry ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.model_sass 5550 model.py:116 - [2949666a-e88f-4556-aa5e-52431d2a1291::EM1] No CRS information passed ('NoneType' object has no attribute 'ExportToProj4'). Assuming WGS84 (srid=4326).
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.task 5550 task.py:61 - [2949666a-e88f-4556-aa5e-52431d2a1291] <Model(name=EM1)> execution finished (result=ModelResult(status='TaskCompleted', status_code=200, data={UUID('2949666a-e88f-4556-aa5e-52431d2a1291'): <Reservoir(geom=POLYHEDRALSURFACE Z (((0 0 0,0 2 0,2 2 0,2 0 0,0 0 0)),((0 0 0,0 2 0,0 2 2,0 0 2,0 0 0)),((0 0 0,2 0 0,2 0 2,0 0 2,0 0 0)),((2 2 2,2 0 2,0 0 2,0 2 2,2 2 2)),((2 2 2,2 0 2,2 0 0,2 2 0,2 2 2)),((2 2 2,2 2 0,0 2 0,0 2 2,2 2 2))), sub_geoms=[])>}, length=1, warning=None))).
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.task 5550 task.py:167 - [2949666a-e88f-4556-aa5e-52431d2a1291] Writing results to DB (db_url=postgresql://damb:xxx@10.97.246.1/ramsis-worker) ...
<RAMSIS-SFMW> 2019-07-22T11:17:42+0000 DEBUG ramsis.sfm.worker.task 5550 task.py:182 - [2949666a-e88f-4556-aa5e-52431d2a1291] Task successfully written.
i.e. log messages now come along with the context prepended ([task_id::model_id]
(e.g. [2949666a-e88f-4556-aa5e-52431d2a1291::EM1]
)) where ::
is the delimiter.
References: #2 (closed)
Edited by damb