Shows current status of competition evaluation.

    Also this method saves error messages generated by attacks and defenses
    into attack_errors.txt and defense_errors.txt.
548920
def show_status(self):
    
    print_header('Attack work statistics')
    self.attack_work.read_all_from_datastore()
    self._show_status_for_work(self.attack_work)
    self._export_work_errors(
        self.attack_work,
        os.path.join(self.results_dir, 'attack_errors.txt'))
    print_header('Defense work statistics')
    self.defense_work.read_all_from_datastore()
    self._show_status_for_work(self.defense_work)
    self._export_work_errors(
        self.defense_work,
        os.path.join(self.results_dir, 'defense_errors.txt'))
271992
def display_progress(cls, operations):
        
        start_crea = datetime.utcnow()

        # count number of operations, 3 steps per operation
        if not isinstance(operations, (list, tuple)):
            operations = [operations]
        count_operations = len(operations) * 3
        updating_done = False
        while not updating_done:
            op_score = 0
            for oper in operations:
                op_ret = cls.call('operation.info', oper['id'])
                op_step = op_ret['step']
                if op_step in cls._op_scores:
                    op_score += cls._op_scores[op_step]
                else:
                    cls.echo('')
                    msg = 'step %s unknown, exiting' % op_step
                    if op_step == 'ERROR':
                        msg = ('An error has occured during operation '
                               'processing: %s' % op_ret['last_error'])
                    elif op_step == 'SUPPORT':
                        msg = ('An error has occured during operation '
                               'processing, you must contact Gandi support.')
                    cls.echo(msg)
                    sys.exit(1)

            cls.update_progress(float(op_score) / count_operations,
                                start_crea)

            if op_score == count_operations:
                updating_done = True

            time.sleep(cls._poll_freq)

        cls.echo('\r')
970340
def verify_challenge(uri):
    
    while True:
        try:
            resp = urlopen(uri)
            challenge_status = json.loads(resp.read().decode('utf8'))
        except IOError as e:
            raise ValueError("Error checking challenge: {0} {1}".format(
                e.code, json.loads(e.read().decode('utf8'))))
        if challenge_status['status'] == "pending":
            time.sleep(2)
        elif challenge_status['status'] == "valid":
            LOGGER.info("Domain verified!")
            break
        else:
            raise ValueError("Domain challenge did not pass: {0}".format(
                challenge_status))
836772
def display_error_message(ex) # :nodoc:
      trace "#{name} aborted!"
      display_exception_details(ex)
      trace "Tasks: #{ex.chain}" if has_chain?(ex)
      trace "(See full trace by running task with --trace)" unless
         options.backtrace
    end
893233
def competition_files(self):
    """"""
    command = [
        "kaggle",
        "datasets" if "/" in self._competition_name else "competitions",
        "files",
        "-v",
        self._competition_name,
    ]
    output = _run_kaggle_command(command, self._competition_name)
    return sorted([
        line.split(",")[0] for line in output.split("\n")[1:] if line
    ])
1072834
def run_defense_work(self, work_id):
    
    class_batch_id = (
        self.defense_work.work[work_id]['output_classification_batch_id'])
    class_batch = self.class_batches.read_batch_from_datastore(class_batch_id)
    adversarial_batch_id = class_batch['adversarial_batch_id']
    submission_id = class_batch['submission_id']
    cloud_result_path = class_batch['result_path']
    logging.info('Defense work piece: '
                 'adversarial_batch_id="%s" submission_id="%s"',
                 adversarial_batch_id, submission_id)
    if submission_id in self.blacklisted_submissions:
      raise WorkerError('Blacklisted submission')
    # get defense
    defense = DefenseSubmission(submission_id, self.submissions,
                                self.storage_bucket)
    defense.download()
    # prepare input - copy adversarial batch locally
    input_dir = os.path.join(LOCAL_INPUT_DIR, adversarial_batch_id)
    if os.path.exists(input_dir):
      sudo_remove_dirtree(input_dir)
    os.makedirs(input_dir)
    try:
      shell_call([
          'gsutil', '-m', 'cp',
          # typical location of adv batch:
          # testing-round/adversarial_images/ADVBATCH000/
          os.path.join('gs://', self.storage_bucket, self.round_name,
                       'adversarial_images', adversarial_batch_id, '*'),
          input_dir
      ])
      adv_images_files = os.listdir(input_dir)
      if (len(adv_images_files) == 1) and adv_images_files[0].endswith('.zip'):
        logging.info('Adversarial batch is in zip archive %s',
                     adv_images_files[0])
        shell_call([
            'unzip', os.path.join(input_dir, adv_images_files[0]),
            '-d', input_dir
        ])
        os.remove(os.path.join(input_dir, adv_images_files[0]))
        adv_images_files = os.listdir(input_dir)
      logging.info('%d adversarial images copied', len(adv_images_files))
    except (subprocess.CalledProcessError, IOError) as e:
      raise WorkerError('Can''t copy adversarial batch locally', e)
    # prepare output directory
    if os.path.exists(LOCAL_OUTPUT_DIR):
      sudo_remove_dirtree(LOCAL_OUTPUT_DIR)
    os.mkdir(LOCAL_OUTPUT_DIR)
    output_filname = os.path.join(LOCAL_OUTPUT_DIR, 'result.csv')
    # run defense
    elapsed_time_sec = defense.run(input_dir, output_filname)
    # evaluate defense result
    batch_result = eval_lib.analyze_one_classification_result(
        storage_client=None,
        file_path=output_filname,
        adv_batch=self.adv_batches.data[adversarial_batch_id],
        dataset_batches=self.dataset_batches,
        dataset_meta=self.dataset_meta)
    # copy result of the defense into storage
    try:
      shell_call([
          'gsutil', 'cp', output_filname,
          os.path.join('gs://', self.storage_bucket, cloud_result_path)
      ])
    except subprocess.CalledProcessError as e:
      raise WorkerError('Can''t result to Cloud Storage', e)
    return elapsed_time_sec, submission_id, batch_result
1081780
def cleanup_failed_attacks(self):
    """"""
    print_header('Cleaning up failed attacks')
    attacks_to_replace = {}
    self.attack_work.read_all_from_datastore()
    failed_submissions = set()
    error_msg = set()
    for k, v in iteritems(self.attack_work.work):
      if v['error'] is not None:
        attacks_to_replace[k] = dict(v)
        failed_submissions.add(v['submission_id'])
        error_msg.add(v['error'])
        attacks_to_replace[k].update(
            {
                'claimed_worker_id': None,
                'claimed_worker_start_time': None,
                'is_completed': False,
                'error': None,
                'elapsed_time': None,
            })
    self.attack_work.replace_work(attacks_to_replace)
    print('Affected submissions:')
    print(' '.join(sorted(failed_submissions)))
    print('Error messages:')
    print(' '.join(sorted(error_msg)))
    print('')
    inp = input_str('Are you sure? (type "yes" without quotes to confirm): ')
    if inp != 'yes':
      return
    self.attack_work.write_all_to_datastore()
    print('Work cleaned up')
1236137
def display_messages
      [:errors, :warnings].each do |type|
        send(type).each do |msg|
          output.puts(msg.to_s)
        end
      end
    end
548527
def status(self):
        
        from rebound import __version__, __build__
        s= ""
        s += "---------------------------------\n"
        s += "REBOUND version:     \t%s\n" %__version__
        s += "REBOUND built on:    \t%s\n" %__build__
        s += "Number of particles: \t%d\n" %self.N       
        s += "Selected integrator: \t" + self.integrator + "\n"       
        s += "Simulation time:     \t%.16e\n" %self.t
        s += "Current timestep:    \t%f\n" %self.dt
        if self.N>0:
            s += "---------------------------------\n"
            for p in self.particles:
                s += str(p) + "\n"
        s += "---------------------------------"
        print(s)
786433
def status(self):
        ''''''
        message = self.status_message
        if message is None:
            message = STATUS[self.status_code]
        return '%s %s' % (self.status_code, message)
249728
def __log_overview_errors(self):
        
        if self.error_file_names:
            self._io.warning('Routines in the files below are not loaded:')
            self._io.listing(sorted(self.error_file_names))
1283274
function statusText()
    {
        if ( $this->Progress == 100 )
        {
            return self::STATUS_COMPLETE;
        }

        if ( $this->Progress < 0 )
        {
            return self::STATUS_NOT_STARTED;
        }

        $timeSinceLastReport = time() - $this->LastReportTimestamp;

        if ( $timeSinceLastReport <= self::STATUS_ACTIVE_TIMEOUT )
        {
            return self::STATUS_ACTIVE;
        }

        if ( $timeSinceLastReport <= self::STATUS_DELAYED_TIMEOUT )
        {
            return self::STATUS_DELAYED;
        }

        return self::STATUS_DEAD;
    }
1099641
public com.google.api.ads.admanager.axis.v201811.WorkflowEvaluationStatus getEvaluationStatus() {
        return evaluationStatus;
    }
1209979
def show(self):
        
        self._verify_entrypoint_selected()

        if self.current_issue_instance_id != -1:
            self._show_current_issue_instance()
            return

        self._show_current_trace_frame()
1108287
def get_statusmsg(self) -> str:
        
        if self._last_status is None:
            return self._last_status
        return self._last_status.decode()
431749
protected void reportMessage(ValidationResult result, Severity severity,
                                 String messageKey, Object... params) {
        result.append(EntryValidations.createMessage(origin, severity, messageKey, params));
    }
6473
def evaluate_severities(data)
        @output[:lint_warnings] = []
        @output[:lint_errors] = []
        @output[:lint_conventions] = []
        @output[:lint_refactors] = []
        @output[:lint_fatals] = []

        return if data.blank?

        data.each do |filename, error_list|
          error_list.each do |message|
            # so that :raw_data remains unaffected
            message = message.clone
            message.delete('length')
            message['filename'] = filename.nil? ? '' : strip_working_dir(filename)
            severity = "lint_#{message['severity']}s".to_sym
            message.delete('severity')
            @output[severity] << message if @output.key?(severity)
          end
        end
        @output
      end