Generates an XML-formatted block that summarizes the state of the JobTracker.
429095
public void generateSummaryTable(JspWriter out,
                                   JobTracker tracker) throws IOException {
    ClusterStatus status = tracker.getClusterStatus();
    int maxMapTasks = status.getMaxMapTasks();
    int maxReduceTasks = status.getMaxReduceTasks();
    int numTaskTrackers = status.getTaskTrackers();
    String tasksPerNodeStr;
    if (numTaskTrackers > 0) {
      double tasksPerNodePct = (double) (maxMapTasks + maxReduceTasks) / (double) numTaskTrackers;
      tasksPerNodeStr = percentFormat.format(tasksPerNodePct);
    } else {
      tasksPerNodeStr = "-";
    }
    out.print("<maps>" + status.getMapTasks() + "</maps>\n" +
            "<reduces>" + status.getReduceTasks() + "</reduces>\n" +
            "<total_submissions>" + tracker.getTotalSubmissions() + "</total_submissions>\n" +
            "<nodes>" + status.getTaskTrackers() + "</nodes>\n" +
            "<map_task_capacity>" + status.getMaxMapTasks() + "</map_task_capacity>\n" +
            "<reduce_task_capacity>" + status.getMaxReduceTasks() + "</reduce_task_capacity>\n" +
            "<avg_tasks_per_node>" + tasksPerNodeStr + "</avg_tasks_per_node>\n");
  }
659464
function Analyser (options) {
	var self = this;

	Block.apply(self, arguments);

	//set generator function
	if (isFn(options)) {
		self.generate = options;
	}

	//create stats analyser
	self.stats = new Stats({
		fftSize: 1024//*32
	}, self.app.context);

	self.content.appendChild(self.stats.element);
	self.node = self.stats.node;

	//go ready state
	self.state = 'ready';

	return self;
}
1290618
def generate_wf_state_log(self):
        
        output = '\n- - - - - -\n'
        output += "WORKFLOW: %s ( %s )" % (self.current.workflow_name.upper(),
                                           self.current.workflow.name)

        output += "\nTASK: %s ( %s )\n" % (self.current.task_name, self.current.task_type)
        output += "DATA:"
        for k, v in self.current.task_data.items():
            if v:
                output += "\n\t%s: %s" % (k, v)
        output += "\nCURRENT:"
        output += "\n\tACTIVITY: %s" % self.current.activity
        output += "\n\tPOOL: %s" % self.current.pool
        output += "\n\tIN EXTERNAL: %s" % self.wf_state['in_external']
        output += "\n\tLANE: %s" % self.current.lane_name
        output += "\n\tTOKEN: %s" % self.current.token
        sys._zops_wf_state_log = output
        return output
416346
def to_markdown(self):
        
        json = self.to_report_json()
        # summary = json['summary']

        s = "# Group: {group} - Dataset: {dataset}\n".format(group=json["group"], dataset=json["dataset"])
        s += "\n## SUMMARY\n\n"
        s += "This report generated on {}\n\n".format(datetime.date.today())
        s += "  * Associations: {}\n" . format(json["associations"])
        s += "  * Lines in file (incl headers): {}\n" . format(json["lines"])
        s += "  * Lines skipped: {}\n" . format(json["skipped_lines"])
        # Header from GAF
        s += "## Header From Original Association File\n\n"
        s += "\n".join(["> {}  ".format(head) for head in self.header])
        ## Table of Contents
        s += "\n\n## Contents\n\n"
        for rule, messages in sorted(json["messages"].items(), key=lambda t: t[0]):
            any_suppress_tag_in_rule_metadata = any([tag in self.config.rule_metadata.get(rule, {}).get("tags", []) for tag in self.config.suppress_rule_reporting_tags])
            # For each tag we say to suppress output for, check if it matches any tag in the rule. If any matches
            if self.config.rule_metadata and any_suppress_tag_in_rule_metadata:
                print("Skipping {rule_num} because the tag(s) '{tag}' are suppressed".format(rule_num=rule, tag=", ".join(self.config.suppress_rule_reporting_tags)))
                continue

            s += "[{rule}](#{rule})\n\n".format(rule=rule)

        s += "\n## MESSAGES\n\n"
        for (rule, messages) in sorted(json["messages"].items(), key=lambda t: t[0]):
            any_suppress_tag_in_rule_metadata = any([tag in self.config.rule_metadata.get(rule, {}).get("tags", []) for tag in self.config.suppress_rule_reporting_tags])

            # Skip if the rule metadata has "silent" as a tag
            if self.config.rule_metadata and any_suppress_tag_in_rule_metadata:
                # If there is a rule metadata, and the rule ID is in the config,
                # get the list of tags if present and check for existence of "silent".
                # If contained, continue to the next rule.
                continue


            s += "### {rule}\n\n".format(rule=rule)
            if rule != "other" and self.config.rule_metadata:
                s += "{title}\n\n".format(title=self.config.rule_metadata.get(rule, {}).get("title", ""))
            s += "* total: {amount}\n".format(amount=len(messages))
            if len(messages) > 0:
                s += "#### Messages\n"
            for message in messages:
                obj = " ({})".format(message["obj"]) if message["obj"] else ""
                s += "* {level} - {type}: {message}{obj} -- `{line}`\n".format(level=message["level"], type=message["type"], message=message["message"], line=message["line"], obj=obj)

        # for g in json['groups']:
        #     s += " * {}: {}\n".format(g['level'], g['count'])
        # s += "\n\n"
        # for g in json['groups']:
        #     level = g['level']
        #     msgs = g['messages']
        #     if len(msgs) > 0:
        #         s += "### {}\n\n".format(level)
        #         for m in msgs:
        #             s += " * {}: obj:'{}' \"{}\" `{}`\n".format(m['type'],m['obj'],m['message'],m['line'])
        return s
136700
private void generateWork() {
        List<DataSource> tables = db().getAllDataSources();
        long now = System.currentTimeMillis();
        List<List<StatusTrail>> stPerDataSource = new ArrayList<>();
        for (DataSource ds:tables) {
            if (ds.getStatus() == null) {
                log.error("DataSource {}'s status is null", ds);
                continue;
            }
            if (JobStatus.valueOf(ds.getStatus()) == JobStatus.done) {                
                continue;
            }
            long currentSpinOffTime = ds.getSpinFromTime();            
            //If startTime = spinOffTime = 00 hr. If now = getTaskAttemptDelay() + 03 hr, and job is hourly job then
            // The following will materialize 00, 01, 02 , 03 adds them to StatusTrail, updates the spinnOff Time to 03.
            // NOTE: All the above times should be within endTime.
            while (now > (currentSpinOffTime + getTaskAttemptDelayInMillis()) && currentSpinOffTime < ds.getEndTime()) {                                
                StatusTrail st = new StatusTrail().setNominalTime(currentSpinOffTime).
                        setAttemptsDone(0).
                        setDataSourceId(ds.getId()).
                        setGivenUp(0).
                        setStatus(JobStatus.not_done);
                db().addStatusTrail(st);
                currentSpinOffTime += JobFreq.valueOf(ds.getFrequency()).inMillis();
                log.info("Generated work : {}", st);
            }
            if (currentSpinOffTime > ds.getEndTime()) {
                ds.setStatus(JobStatus.done);
            }
            stPerDataSource.add(db().getIncompleteTasks(ds));
            //Update the spinOff Time to point to time from which next set of materialization will happen.
            db().updateDataSource(ds.setSpinFromTime(currentSpinOffTime));
        }
        newWorkQueue.clearAndMergeKLists(stPerDataSource);
    }
1330882
synchronized TaskReport generateSingleReport() {
    ArrayList<String> diagnostics = new ArrayList<String>();
    for (List<String> l : taskDiagnosticData.values()) {
      diagnostics.addAll(l);
    }
    TIPStatus currentStatus = null;
    if (isRunning() && !isComplete()) {
      currentStatus = TIPStatus.RUNNING;
    } else if (isComplete()) {
      currentStatus = TIPStatus.COMPLETE;
    } else if (wasKilled()) {
      currentStatus = TIPStatus.KILLED;
    } else if (isFailed()) {
      currentStatus = TIPStatus.FAILED;
    } else if (!(isComplete() || isRunning() || wasKilled())) {
      currentStatus = TIPStatus.PENDING;
    }
    
    TaskReport report = new TaskReport
      (getTIPId(), (float)progress, state,
       diagnostics.toArray(new String[diagnostics.size()]),
       currentStatus, execStartTime, execFinishTime, counters);
    if (currentStatus == TIPStatus.RUNNING) {
      report.setRunningTaskAttempts(activeTasks.keySet());
    } else if (currentStatus == TIPStatus.COMPLETE) {
      report.setSuccessfulAttempt(getSuccessfulTaskid());
    }
    return report;
  }
455870
def generate(self):
    
    self._setup()

    header_html = self._generate_header()
    footer_html = self._generate_footer()
    results_topbar_html = self._generate_topbar("results")
    summary_topbar_html = self._generate_topbar("summary")
    logs_topbar_html = self._generate_topbar("logs")
    diff_topbar_html = self._generate_topbar("diff")

    summary_body_html = self._generate_summary_body()
    diff_body_html = self._generate_diff_body()
    summary_html = header_html + summary_topbar_html + summary_body_html + footer_html
    diff_html = header_html + diff_topbar_html + diff_body_html+ footer_html
    Reporter._make_file(summary_html, self.report_info.home_page)
    Reporter._make_file(diff_html,self.report_info.diff_page)

    log_body_html = self._generate_log_body()
    log_html = header_html + logs_topbar_html + log_body_html+footer_html
    Reporter._make_file(log_html, self.report_info.log_page)

    for config_name in self.report_info.config_to_test_names_map.keys():
      config_dir = os.path.join(self.report_info.resource_dir, config_name)
      utils.makedirs(config_dir)

      config_body_html = self._generate_config_body(config_name)
      config_html = header_html + results_topbar_html + config_body_html + footer_html
      config_file = os.path.join(config_dir, config_name + self.report_info.report_file_sfx)
      Reporter._make_file(config_html, config_file)

      for test_name in self.data_source.get_test_names(config_name):
        test_body_html = self._generate_test_body(config_name, test_name)
        test_html = header_html + results_topbar_html + test_body_html + footer_html
        test_file = os.path.join(config_dir, test_name + self.report_info.report_file_sfx)
        Reporter._make_file(test_html, test_file)
1246354
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.startTag("FindBugsProfile");
        xmlOutput.stopTag(false);
        TreeSet<Class<?>> treeSet = new TreeSet<>(new TotalTimeComparator(this));
        treeSet.addAll(profile.keySet());
        long totalTime = 0;
        for (Profile p : profile.values()) {
            totalTime += p.totalTime.get();
        }

        long accumulatedTime = 0;

        for (Class<?> c : treeSet) {
            Profile p = getProfile(c);
            if (p == null) {
                continue;
            }
            p.writeXML(xmlOutput);
            accumulatedTime += p.totalTime.get();
            if (accumulatedTime > 3 * totalTime / 4) {
                break;
            }
        }
        xmlOutput.closeTag("FindBugsProfile");
    }
113308
def tracked(self):
        ''''''
        results = json.loads(self.client('track'))
        results['jobs'] = [Job(self, **job) for job in results['jobs']]
        return results
731856
private void initTrackersToTasksMap(Collection<JobInProgress> jobsInProgress) {
    for (TaskTrackerStatus tracker : taskTrackersDetails) {
      taskTrackerExtendedTasks.put(tracker.getTrackerName(),
              new ArrayList<TaskStatus>());
    }
    for (JobInProgress job : jobsInProgress) {
      total_map_tasks += job.getTasks(TaskType.MAP).length;
      total_reduce_tasks += job.getTasks(TaskType.REDUCE).length;
      for (TaskInProgress task : job.getTasks(TaskType.REDUCE)) {

        TaskStatus[] taskStatuses = task.getTaskStatuses();
        for (TaskStatus status : taskStatuses) {
          Collection<TaskStatus> trackerTasks =
                  taskTrackerExtendedTasks.get(status.getTaskTracker());
          if (trackerTasks == null) {
            trackerTasks = new ArrayList<TaskStatus>();
            taskTrackerExtendedTasks.put(status.getTaskTracker(),
                    trackerTasks);
          }
          trackerTasks.add(status);
        }
      }
      for (TaskInProgress task : job.getTasks(TaskType.MAP)) {
        TaskStatus[] taskStatuses = task.getTaskStatuses();
        for (TaskStatus status : taskStatuses) {
          Collection<TaskStatus> trackerTasks =
                  taskTrackerExtendedTasks.get(status.getTaskTracker());
          if (trackerTasks == null) {
            trackerTasks = new ArrayList<TaskStatus>();
            taskTrackerExtendedTasks.put(status.getTaskTracker(),
                    trackerTasks);
          }
          trackerTasks.add(status);
        }
      }
    }
  }
208125
public void displayState() {
        PrintWriter xout = context.get(Log.logKey).getWriter(Log.WriterKind.STDERR);
        xout.println("File Object History : " +  fileObjectHistory);
        xout.println("Open Type Names     : " +  openTypeNames);
        xout.println("Gen. Src Names      : " +  generatedSourceNames);
        xout.println("Gen. Cls Names      : " +  generatedClasses.keySet());
        xout.println("Agg. Gen. Src Names : " +  aggregateGeneratedSourceNames);
        xout.println("Agg. Gen. Cls Names : " +  aggregateGeneratedClassNames);
    }
1162477
public void printJobExecutionStatistics() {
    /*
     * Print Job Counters
     */
    System.out.println("JOB COUNTERS *********************************************");
    int size = this._job.size();
    java.util.Iterator<Map.Entry<Enum, String>> kv = this._job.entrySet().iterator();
    for (int i = 0; i < size; i++)
    {
      Map.Entry<Enum, String> entry = (Map.Entry<Enum, String>) kv.next();
      Enum key = entry.getKey();
      String value = entry.getValue();
      System.out.println("Key:<" + key.name() + ">, value:<"+ value +">"); 
    }
    /*
     * 
     */
    System.out.println("MAP COUNTERS *********************************************");
    int size1 = this._mapTaskList.size();
    for (int i = 0; i < size1; i++)
    {
      System.out.println("MAP TASK *********************************************");
      this._mapTaskList.get(i).printKeys();
    }
    /*
     * 
     */
    System.out.println("REDUCE COUNTERS *********************************************");
    int size2 = this._mapTaskList.size();
    for (int i = 0; i < size2; i++)
    {
      System.out.println("REDUCE TASK *********************************************");
      this._reduceTaskList.get(i).printKeys();
    }
  }
763780
def toxml(self):
        

        return '<StateVariable name="{0}" dimension="{1}"'.format(self.name, self.dimension) +\
          (' exposure="{0}"'.format(self.exposure) if self.exposure else '') +\
          '/>'
855271
def generateIntrospectionXML(objectPath, exportedObjects):
    
    l = [_dtd_decl]
    l.append('<node name="%s">' % (objectPath,))

    obj = exportedObjects.get(objectPath, None)
    if obj is not None:
        for i in obj.getInterfaces():
            l.append(i.introspectionXml)
        l.append(_intro)

    # make sure objectPath ends with '/' to only get partial matches based on
    # the full path, not a part of a subpath
    if not objectPath.endswith('/'):
        objectPath += '/'
    matches = []
    for path in exportedObjects.keys():
        if path.startswith(objectPath):
            path = path[len(objectPath):].partition('/')[0]
            if path not in matches:
                matches.append(path)

    if obj is None and not matches:
        return None

    for m in matches:
        l.append('<node name="%s"/>' % m)

    l.append('</node>')
    return '\n'.join(l)
193344
protected void traceJobXML(String jobXML) {

        if (logger.isLoggable(Level.FINE)) {
            int concatLen = jobXML.length() > 200 ? 200 : jobXML.length();
            logger.fine("Starting job: " + jobXML.substring(0, concatLen) + "... truncated ...");
        }
    }
619841
private <Q, R> void recordFinalStatus(JobIdentifier<Q, R> jobId, JobStatus<Q, R> jobStatus) {
        try {
            _jobStatusDAO.updateJobStatus(jobId, jobStatus);
        } catch (Exception e) {
            _log.error("Failed to record final status for job: [id={}, status={}]", jobId, jobStatus.getStatus(), e);
        }
    }
614242
def start_output (self):
        
        super(CustomXMLLogger, self).start_output()
        self.xml_start_output()
        attrs = {"created": strformat.strtime(self.starttime)}
        self.xml_starttag(u'linkchecker', attrs)
        self.flush()