Add basic views to expose Problem Reports, and run them
not very sophisticated yet but heck better than we had yesterday
This commit is contained in:
parent
f687078bbf
commit
871dd35a3a
4 changed files with 263 additions and 28 deletions
|
@ -850,7 +850,7 @@ class BatchMasterView(MasterView):
|
|||
|
||||
# launch thread to invoke handler action
|
||||
thread = Thread(target=self.action_subprocess_thread,
|
||||
args=(batch.uuid, port, username, batch_action, progress),
|
||||
args=((batch.uuid,), port, username, batch_action, progress),
|
||||
kwargs=kwargs)
|
||||
thread.start()
|
||||
|
||||
|
@ -859,7 +859,7 @@ class BatchMasterView(MasterView):
|
|||
|
||||
# launch thread to populate batch; that will update session progress directly
|
||||
target = getattr(self, '{}_thread'.format(batch_action))
|
||||
thread = Thread(target=target, args=(batch.uuid, user_uuid, progress), kwargs=kwargs)
|
||||
thread = Thread(target=target, args=((batch.uuid,), user_uuid, progress), kwargs=kwargs)
|
||||
thread.start()
|
||||
|
||||
return self.render_progress(progress, {
|
||||
|
@ -894,7 +894,7 @@ class BatchMasterView(MasterView):
|
|||
log.debug("launching command in subprocess: %s", cmd)
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
def action_subprocess_thread(self, batch_uuid, port, username, handler_action, progress, **kwargs):
|
||||
def action_subprocess_thread(self, key, port, username, handler_action, progress, **kwargs):
|
||||
"""
|
||||
This method is sort of an alternative thread target for batch actions,
|
||||
to be used in the event versioning is enabled for the main process but
|
||||
|
@ -902,6 +902,8 @@ class BatchMasterView(MasterView):
|
|||
launch a separate process with versioning disabled in order to act on
|
||||
the batch.
|
||||
"""
|
||||
batch_uuid = key[0]
|
||||
|
||||
# figure out the (sub)command args we'll be passing
|
||||
subargs = [
|
||||
'--batch-type',
|
||||
|
@ -1216,7 +1218,7 @@ class BatchMasterView(MasterView):
|
|||
def execute_error_message(self, error):
|
||||
return "Batch execution failed: {}".format(simple_error(error))
|
||||
|
||||
def execute_thread(self, batch_uuid, user_uuid, progress, **kwargs):
|
||||
def execute_thread(self, key, user_uuid, progress, **kwargs):
|
||||
"""
|
||||
Thread target for executing a batch with progress indicator.
|
||||
"""
|
||||
|
@ -1224,7 +1226,7 @@ class BatchMasterView(MasterView):
|
|||
# session here; can't use tailbone because it has web request
|
||||
# transaction binding etc.
|
||||
session = RattailSession()
|
||||
batch = session.query(self.model_class).get(batch_uuid)
|
||||
batch = self.get_instance_for_key(key, session)
|
||||
user = session.query(model.User).get(user_uuid)
|
||||
try:
|
||||
result = self.handler.do_execute(batch, user=user, progress=progress, **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue