Prints task information.

            `env`
                Runtime ``Environment`` instance.
            `args`
                Arguments object from arg parser.
965316
def execute(self, env, args):
        

        start = self._fuzzy_time_parse(args.start)
        if not start:
            raise errors.FocusError(u'Invalid start period provided')

        stats = self._get_stats(env.task, start)
        self._print_stats(env, stats)
633420
def show_version(self):
        
        version_info = self.get_cli_version()
        version_info += self.get_runtime_version()
        print(version_info, file=self.out_file)
41620
def execute(self, env, args):
        

        # extract args
        old_task_name = args.old_task_name
        new_task_name = args.new_task_name

        if old_task_name == new_task_name:
            raise errors.FocusError(u'Could not rename task to itself')

        if env.task.active and env.task.name == old_task_name:
            raise errors.ActiveTask

        env.task.rename(old_task_name, new_task_name)
1142632
def print_pretty_command(env, command):
    
    cmd = abbr_cmd = command[0]
    if cmd.startswith(env.envbindir):
        abbr_cmd = os.path.relpath(cmd, env.envbindir)
        if abbr_cmd == ".":
            # TODO are there more edge cases?
            abbr_cmd = cmd
    command[0] = abbr_cmd
    print('(%s)$ %s' % (env.name, ' '.join(['"%s"' % c if " " in c
                                            else c
                                            for c in command])))
    command[0] = cmd
    return abbr_cmd, cmd, command
885202
def env(*_vars, **kwargs):
    
    for v in _vars:
        value = os.environ.get(v, None)
        if value:
            return value
    return kwargs.get('default', '')
1173561
def print_env(k, v)
      if v
        puts @shell_printer.export(k, v)
      else
        puts @shell_printer.unset(k)
      end
    end
645597
def env_check(self, *args, **kwargs):
        
        b_status    = True
        str_error   = ''
        if not len(self.str_outputDir): 
            b_status = False
            str_error   = 'output directory not specified.'
            self.dp.qprint(str_error, comms = 'error')
            error.warn(self, 'outputDirFail', drawBox = True)
        return {
            'status':       b_status,
            'str_error':    str_error
        }
476067
def do_summary(self, args):
        ''''''
        assert args.json or args.text or (args.text is None)
        do_text = args.text

        xd = {}
        for ws in self.task_master.iter_work_specs():
            name = ws['name']
            status = self.task_master.status(name)
            xd[name] = status
        xd['_NOW'] = time.time()

        if args.json:
            self.stdout.write(json.dumps(xd) + '\n')
        else:
            if do_text is None:
                do_text = True

        if do_text:
            self.stdout.write('Work spec               Avail  Pending  Blocked'
                              '   Failed Finished    Total\n')
            self.stdout.write('==================== ======== ======== ========'
                              ' ======== ======== ========\n')
            for name in sorted(xd.keys()):
                if name == '_NOW':
                    continue
                status = xd[name]
                self.stdout.write('{0:20s} {1[num_available]:8d} '
                                  '{1[num_pending]:8d} {1[num_blocked]:8d} '
                                  '{1[num_failed]:8d} {1[num_finished]:8d} '
                                  '{1[num_tasks]:8d}\n'.format(name, status))
1120584
def execute(self, env, args):
        

        # start the task
        if env.task.start(args.task_name):
            env.io.success(u'Task Loaded.')
644754
def print_environment_vars(env):
    
    ansible_env = {k: v for (k, v) in env.items() if 'ANSIBLE_' in k}
    print_debug('ANSIBLE ENVIRONMENT', safe_dump(ansible_env))

    molecule_env = {k: v for (k, v) in env.items() if 'MOLECULE_' in k}
    print_debug('MOLECULE ENVIRONMENT', safe_dump(molecule_env))

    combined_env = ansible_env.copy()
    combined_env.update(molecule_env)
    print_debug(
        'SHELL REPLAY', " ".join(
            ["{}={}".format(k, v) for (k, v) in sorted(combined_env.items())]))
    print()
313593
def debug(self):  # pragma: no cover
        """"""

        print("Aliases:")
        pprint.pprint(self._aliases)
        print("Override:")
        pprint.pprint(self._override)
        print("Args:")
        pprint.pprint(self._args)
        print("Env:")
        pprint.pprint(self._env)
        print("Config:")
        pprint.pprint(self._config)
        print("Key/Value Store:")
        pprint.pprint(self._kvstore)
        print("Defaults:")
        pprint.pprint(self._defaults)
1043034
public static void main(String[] args) {
        try {
            if (args.length < 1) {
                System.err.println();
                System.err.println(Globals.getWorkbenchInfoString());
                System.err.println();
                System.err.println("No task specified.");
            } else {
                if (isJavaVersionOK() == false || WekaUtils.isWekaVersionOK() == false) {
                    return;
                }
                // create standard options
                FlagOption suppressStatusOutputOption = new FlagOption(
                        "suppressStatusOutput", 'S',
                        "Suppress the task status output that is normally send to stderr.");
                FlagOption suppressResultOutputOption = new FlagOption(
                        "suppressResultOutput", 'R',
                        "Suppress the task result output that is normally send to stdout.");
                IntOption statusUpdateFrequencyOption = new IntOption(
                        "statusUpdateFrequency",
                        'F',
                        "How many milliseconds to wait between status updates.",
                        1000, 0, Integer.MAX_VALUE);
                Option[] extraOptions = new Option[]{
                    suppressStatusOutputOption, suppressResultOutputOption,
                    statusUpdateFrequencyOption};
                // build a single string by concatenating cli options
                StringBuilder cliString = new StringBuilder();
                for (int i = 0; i < args.length; i++) {
                    cliString.append(" ").append(args[i]);
                }
                // parse options
                AbstractTask task;
                try {
                	task = (AbstractTask) ClassOption.cliStringToObject(
                			cliString.toString(), MainTask.class, extraOptions);
                } catch(Exception e) {
                	// regular task could not be found, maybe it is a meta task
            		task = (AbstractTask) ClassOption.cliStringToObject(
            				cliString.toString(), MetaMainTask.class, extraOptions);
                }
                task.prepareForUse();
                
                Object result = null;
                if (suppressStatusOutputOption.isSet()) {
                    result = task.doTask();
                } else {
                    System.err.println();
                    System.err.println(Globals.getWorkbenchInfoString());
                    System.err.println();
                    boolean preciseTiming = TimingUtils.enablePreciseTiming();
                    // start the task thread
                    TaskThread taskThread = new TaskThread(task);
                    taskThread.start();
                    int progressAnimIndex = 0;
                    // inform user of progress
                    while (!taskThread.isComplete()) {
                        StringBuilder progressLine = new StringBuilder();
                        progressLine.append(progressAnimSequence[progressAnimIndex]);
                        progressLine.append(' ');
                        progressLine.append(StringUtils.secondsToDHMSString(taskThread.getCPUSecondsElapsed()));
                        progressLine.append(" [");
                        progressLine.append(taskThread.getCurrentStatusString());
                        progressLine.append("] ");
                        double fracComplete = taskThread.getCurrentActivityFracComplete();
                        if (fracComplete >= 0.0) {
                            progressLine.append(StringUtils.doubleToString(
                                    fracComplete * 100.0, 2, 2));
                            progressLine.append("% ");
                        }
                        progressLine.append(taskThread.getCurrentActivityString());
                        while (progressLine.length() < MAX_STATUS_STRING_LENGTH) {
                            progressLine.append(" ");
                        }
                        if (progressLine.length() > MAX_STATUS_STRING_LENGTH) {
                            progressLine.setLength(MAX_STATUS_STRING_LENGTH);
                            progressLine.setCharAt(
                                    MAX_STATUS_STRING_LENGTH - 1, '~');
                        }
                        System.err.print(progressLine.toString());
                        System.err.print('\r');
                        if (++progressAnimIndex >= progressAnimSequence.length) {
                            progressAnimIndex = 0;
                        }
                        try {
                            Thread.sleep(statusUpdateFrequencyOption.getValue());
                        } catch (InterruptedException ignored) {
                            // wake up
                        }
                    }
                    StringBuilder cleanupString = new StringBuilder();
                    for (int i = 0; i < MAX_STATUS_STRING_LENGTH; i++) {
                        cleanupString.append(' ');
                    }
                    System.err.println(cleanupString);
                    result = taskThread.getFinalResult();
                    if (!(result instanceof FailedTaskReport)) {
                        System.err.print("Task completed in "
                                + StringUtils.secondsToDHMSString(taskThread.getCPUSecondsElapsed()));
                        if (preciseTiming) {
                            System.err.print(" (CPU time)");
                        }
                        System.err.println();
                        System.err.println();
                    }
                }
                if (result instanceof FailedTaskReport) {
                    System.err.println("Task failed. Reason: ");
                    ((FailedTaskReport) result).getFailureReason().printStackTrace();
                } else {
                    if (!suppressResultOutputOption.isSet()) {
                        if (result instanceof Measurement[]) {
                            StringBuilder sb = new StringBuilder();
                            Measurement.getMeasurementsDescription(
                                    (Measurement[]) result, sb, 0);
                            System.out.println(sb.toString());
                        } else {
                            System.out.println(result);
                        }
                        System.out.flush();
                    }
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
277706
def print_app_info (out=stderr):
    """"""
    print(_("System info:"), file=out)
    print(configuration.App, file=out)
    print(_("Released on:"), configuration.ReleaseDate, file=out)
    print(_("Python %(version)s on %(platform)s") %
                    {"version": sys.version, "platform": sys.platform}, file=out)
    for key in PYTHON_ENV_VARS:
        print_env_info(key, out=out)
    print(configuration.get_modules_info(), file=out)
    stime = strformat.strtime(time.time())
    print(_("Local time:"), stime, file=out)
    print(_("sys.argv:"), sys.argv, file=out)
200099
def call!(env)
      env['deas.logging'] = Proc.new{ |msg| } # no-op
      status, headers, body = super(env)
      request = Rack::Request.new(env)
      line_attrs = {
        'method'  => request.request_method,
        'path'    => request.path,
        'params'  => env['deas.params'],
        'splat'   => env['deas.splat'],
        'time'    => env['deas.time_taken'],
        'status'  => status
      }
      if env['deas.handler_class']
        line_attrs['handler'] = env['deas.handler_class'].name
      end
      if headers.key?('Location')
        line_attrs['redir'] = headers['Location']
      end
      log SummaryLine.new(line_attrs)
      [status, headers, body]
    end
93818
def print_summary(self) -> None:
        
        print("Tasks execution time summary:")
        for mon_task in self._monitor_tasks:
            print("%s:\t%.4f (sec)" % (mon_task.task_name, mon_task.total_time))
1284067
def _parse_args(argv):
    
    parser = make_parser()
    args = parser.parse_args(argv)
    LOGGER.setLevel(to_log_level(args.loglevel))

    if args.inputs:
        if '-' in args.inputs:
            args.inputs = sys.stdin
    else:
        if args.list:
            _show_psrs()
        elif args.env:
            cnf = os.environ.copy()
            _output_result(cnf, args.output, args.otype or "json", None, None)
            sys.exit(0)
        else:
            parser.print_usage()
            sys.exit(1)

    if args.validate and args.schema is None:
        _exit_with_output("--validate option requires --scheme option", 1)

    return args
152305
def info():
    
    print()
    print('root directory         :', tasks.conf.APE_ROOT)
    print()
    print('active container       :', os.environ.get('CONTAINER_NAME', ''))
    print()
    print('active product         :', os.environ.get('PRODUCT_NAME', ''))
    print()
    print('ape feature selection  :', tasks.FEATURE_SELECTION)
    print()
    print('containers and products:')
    print('-' * 30)
    print()
    for container_name in tasks.get_containers():
        print(container_name)
        for product_name in tasks.get_products(container_name):
            print('    ' + product_name)
    print()