@@ -91,6 +91,32 @@ def test_status(self):
91
91
assert s .uuid == "fbf3cd00-0102-11ed-8421-e4b97ac7e02e"
92
92
assert s .data == "somedata"
93
93
94
+ def test_crashed_process (self ):
95
+ fake_process_status_data = {
96
+ "process" : {"uuid" : "0cf3cd00-0102-11ed-8421-e4b97ac7e02e" },
97
+ "status" : {
98
+ "status" : "started" ,
99
+ "time" : "2022-07-11T17:07:18Z" ,
100
+ "percent_done" : "10" ,
101
+ "message" : "PyWPS Process Started"
102
+ }
103
+ }
104
+
105
+ dblog .log_request (fake_process_status_data ["process" ]["uuid" ], fake_request )
106
+ dblog .store_status (fake_process_status_data ["process" ]["uuid" ], dblog .WPS_STATUS .STARTED , "accepted" , 10 )
107
+ dblog .update_pid (fake_process_status_data ["process" ]["uuid" ], - 1 ) # some invalid pid
108
+ dblog .update_status_record (fake_process_status_data ["process" ]["uuid" ], fake_process_status_data )
109
+
110
+ s = dblog .get_status_record (fake_process_status_data ["process" ]["uuid" ])
111
+ assert s .uuid == fake_process_status_data ["process" ]["uuid" ]
112
+ assert s .data ['status' ]['status' ] == 'started'
113
+
114
+ dblog .cleanup_crashed_process ()
115
+
116
+ s = dblog .get_status_record (fake_process_status_data ["process" ]["uuid" ])
117
+ assert s .uuid == fake_process_status_data ["process" ]["uuid" ]
118
+ assert s .data ['status' ]['status' ] == 'failed'
119
+
94
120
95
121
def load_tests (loader = None , tests = None , pattern = None ):
96
122
"""Load local tests
0 commit comments