Commit 6dddb7c2 authored by Luis Araujo's avatar Luis Araujo

Add --live option to submit command

This option allows to submit a job and shows its live output
once it starts running.

This option can't be used together with the --wait option or
if more than one job is submitted.

Reviewed By: Sjoerd Simons <>
Differential Revision: Luis Araujo's avatarLuis Araujo <>
parent fe286a57
......@@ -75,6 +75,8 @@ class Cli(object):
choices=['high', 'medium', 'low'],
help="Set the job priority"),
submit_parser.add_argument('--live', action='store_true',
help="show job output live")
submit_parser.add_argument('--check-image-url', action='store_true',
help="Check that the image url exists before "
"submitting job")
......@@ -32,6 +32,7 @@ from jinja2 import Environment, FileSystemLoader, \
from lqa_api.exit_codes import APPLICATION_ERROR
from lqa_api.job import Job
from lqa_api.waitqueue import WaitQueue
from lqa_api.outputlog import OutputLog, OutputLogError
from lqa_tool.settings import lqa_logger
from lqa_tool.utils import merge_profiles
from lqa_tool.commands import Command
......@@ -215,6 +216,23 @@ class SubmitCmd(Command):"Submitted job {} with id {}" \
.format(job_file, job_id))
# Show live output if '--live' option passed
if len(job_files) > 1:"lqa submit: --live option is not valid "
"with more than 1 file (skipping)")
elif self.args.wait_timeout:"lqa submit: --live option can't be used "
"together with --wait option (skipping)")
# Everything is valid to use live option, then go for it!
OutputLog(job_id, self.server, is_live=True,
except OutputLogError as e:
lqa_logger.error("lqa submit: error: {}".format(e))
def _check_image_url(self, json_job_obj):
"""This method checks for the existence of the image field url path
for all the 'deploy_image' actions (if available)"""
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