|
@@ 283-303 (lines=21) @@
|
| 280 |
|
self.session = session |
| 281 |
|
self.run = None |
| 282 |
|
|
| 283 |
|
def started_event(self, ex_info, command, host_info, start_time, config, |
| 284 |
|
meta_info, _id): |
| 285 |
|
Base.metadata.create_all(self.engine) |
| 286 |
|
sql_exp = Experiment.get_or_create(ex_info, self.session) |
| 287 |
|
sql_host = Host.get_or_create(host_info, self.session) |
| 288 |
|
if _id is None: |
| 289 |
|
i = self.session.query(Run).order_by(Run.run_id.desc()).first() |
| 290 |
|
_id = '0' if i is None else str(int(i.run_id) + 1) |
| 291 |
|
|
| 292 |
|
self.run = Run(run_id=_id, |
| 293 |
|
start_time=start_time, |
| 294 |
|
config=json.dumps(flatten(config)), |
| 295 |
|
command=command, |
| 296 |
|
priority=meta_info.get('priority', 0), |
| 297 |
|
comment=meta_info.get('comment', ''), |
| 298 |
|
experiment=sql_exp, |
| 299 |
|
host=sql_host, |
| 300 |
|
status='RUNNING') |
| 301 |
|
self.session.add(self.run) |
| 302 |
|
self.session.commit() |
| 303 |
|
return _id or self.run.run_id |
| 304 |
|
|
| 305 |
|
def queued_event(self, ex_info, command, queue_time, config, meta_info, |
| 306 |
|
_id): |
|
@@ 305-323 (lines=19) @@
|
| 302 |
|
self.session.commit() |
| 303 |
|
return _id or self.run.run_id |
| 304 |
|
|
| 305 |
|
def queued_event(self, ex_info, command, queue_time, config, meta_info, |
| 306 |
|
_id): |
| 307 |
|
|
| 308 |
|
Base.metadata.create_all(self.engine) |
| 309 |
|
sql_exp = Experiment.get_or_create(ex_info, self.session) |
| 310 |
|
if _id is None: |
| 311 |
|
i = self.session.query(Run).order_by(Run.run_id.desc()).first() |
| 312 |
|
_id = '0' if i is None else str(int(i.id) + 1) |
| 313 |
|
|
| 314 |
|
self.run = Run(run_id=_id, |
| 315 |
|
config=json.dumps(flatten(config)), |
| 316 |
|
command=command, |
| 317 |
|
priority=meta_info.get('priority', 0), |
| 318 |
|
comment=meta_info.get('comment', ''), |
| 319 |
|
experiment=sql_exp, |
| 320 |
|
status='QUEUED') |
| 321 |
|
self.session.add(self.run) |
| 322 |
|
self.session.commit() |
| 323 |
|
return _id or self.run.run_id |
| 324 |
|
|
| 325 |
|
def heartbeat_event(self, info, captured_out, beat_time): |
| 326 |
|
self.run.info = json.dumps(flatten(info)) |