Commit 6b27a293 authored by Thomas Phil's avatar Thomas Phil

RM-56 added command to retrieve stdout of process

parent 1e644cab
......@@ -29,7 +29,8 @@ from strongr.cli import DeploySingleCommand, ListDeployedVmsCommand,\
IsValidUserCommand, RunRestServerCommand,\
RunWorkerCommand, DestroySingleCommand,\
DestroyManyCommand, EnsureMinAmountOfNodesCommand, \
MakeDbCommand, RunTestsCommand, TestCommand, CleanupCommand
MakeDbCommand, RunTestsCommand, TestCommand, CleanupCommand,\
GetJobStdOut
application = Application()
......@@ -51,6 +52,7 @@ application.add(MakeDbCommand())
application.add(RunTestsCommand())
application.add(TestCommand())
application.add(CleanupCommand())
application.add(GetJobStdOut())
if __name__ == '__main__':
application.run(input_=argvInputs)
......@@ -15,3 +15,4 @@ from .makedbcommand import MakeDbCommand
from .runtestscommand import RunTestsCommand
from .testcommand import TestCommand
from .cleanupcommand import CleanupCommand
from .getjobstdout import GetJobStdOut
from strongr.core.domain.schedulerdomain import SchedulerDomain
from .wrapper import Command
import strongr.core.domain.schedulerdomain
import json
class GetJobStdOut(Command):
"""
Returns a jobs stdout
job:stdout
{jid : The job id to be checked}
"""
def handle(self):
query_factory = strongr.core.domain.schedulerdomain.SchedulerDomain.queryFactory()
query_bus = strongr.core.domain.schedulerdomain.SchedulerDomain.schedulerService().getQueryBus()
command = query_factory.newRequestTaskInfo(self.argument('jid'))
result = query_bus.handle(command)
if result is None:
print(json.dumps({}))
return
print(json.dumps({'job_id': result.job_id, 'stdout': result.stdout}))
class RequestJobInfo:
def __init__(self, taskid):
self.taskid = taskid
def __init__(self, job_id):
self.job_id = job_id
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment