X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=commands%2Fjob.py;h=f5805feaa557dcaf65007cdf09ed75c8a5f1ef6d;hb=fe93dec3df59f9238c50e52cce21d939fa4ccc1c;hp=53a7751b570f723541040e4561cbb234106c1420;hpb=7fc497ede4c9d2e94f72962b25e001087346fcb7;p=tools%2Fsat.git diff --git a/commands/job.py b/commands/job.py index 53a7751..f5805fe 100644 --- a/commands/job.py +++ b/commands/job.py @@ -17,12 +17,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os -import sys -import traceback -import tempfile import src -import salomeTools +import src.salomeTools # Define all possible option for the make command : sat make parser = src.options.Options() @@ -38,9 +35,12 @@ def description(): :return: The text to display for the job command description. :rtype: str ''' - return _("Executes the commands of the job defined" - " in the jobs configuration file\n\nexample:\nsat job " - "--jobs_config my_jobs --name my_job") + return _("""\ +The job command executes the commands of the job defined in the jobs configuration file + +example: +>> sat job --jobs_config my_jobs --name my_job +""") def run(args, runner, logger): '''method that is called when salomeTools is called with job parameter. @@ -117,7 +117,7 @@ def run(args, runner, logger): cmd_exe = command.split(" ")[0] # first part if cmd_exe == "sat": # use the salomeTools parser to get the options of the command - sat_parser = salomeTools.parser + sat_parser = src.salomeTools.parser input_parser = src.remove_item_from_list(command.split(' ')[1:], "") (options, argus) = sat_parser.parse_args(input_parser) # Verify if there is a changed option @@ -130,8 +130,7 @@ def run(args, runner, logger): end_cmd = " ".join(argus[1:]) else: sat_command_name = "shell" - end_cmd = "--command " + command - + end_cmd = ["--command", command] # Do not change the options if no option was called in the command if not(specific_option): options = None @@ -146,35 +145,20 @@ def run(args, runner, logger): error = "" stack = "" - try: - # Execute the command - code = sat_command(end_cmd, - options = options, - batch = True, - verbose = 0, - logger_add_link = logger) - except Exception as e: - code = 1 - # Get error - error = str(e) - # get stack - __, __, exc_traceback = sys.exc_info() - fp = tempfile.TemporaryFile() - traceback.print_tb(exc_traceback, file=fp) - fp.seek(0) - stack = fp.read() - logger.add_link(_("Dead Link"), - sat_command_name, - code, - "ERROR: %s TRACEBACK: %s" % (error, - stack.replace('"',"'"))) + # Execute the command + code = sat_command(end_cmd, + options = options, + batch = True, + verbose = 0, + logger_add_link = logger) # Print the status of the command if code == 0: nb_pass += 1 logger.write('%s\n' % src.printcolors.printc(src.OK_STATUS), 3) else: - res = 1 + if sat_command_name != "test": + res = 1 logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS), error), 3) if len(stack) > 0: