Adjust job-level metrics when the task gets retried.

@param branches number of forked branches
435621
public void adjustJobMetricsOnRetry(int branches) {
    TaskMetrics metrics = TaskMetrics.get(this);

    for (int i = 0; i < branches; i++) {
      String forkBranchId = ForkOperatorUtils.getForkId(this.taskId, i);
      long recordsWritten = metrics.getCounter(MetricGroup.TASK.name(), forkBranchId, RECORDS).getCount();
      long bytesWritten = metrics.getCounter(MetricGroup.TASK.name(), forkBranchId, BYTES).getCount();
      metrics.getCounter(MetricGroup.JOB.name(), this.jobId, RECORDS).dec(recordsWritten);
      metrics.getCounter(MetricGroup.JOB.name(), this.jobId, BYTES).dec(bytesWritten);
    }
  }
994667
public void setBranches(java.util.Collection<Branch> branches) {
        if (branches == null) {
            this.branches = null;
            return;
        }

        this.branches = new java.util.ArrayList<Branch>(branches);
    }
951865
def _checkSuccessorReadyToRunMultiplePredecessors(self, jobGraph, jobNode, successorJobStoreID):
        """"""
        # See implementation note at the top of this file for discussion of multiple predecessors
        logger.debug("Successor job: %s of job: %s has multiple "
                     "predecessors", jobNode, jobGraph)

        # Get the successor job graph, which is caches
        if successorJobStoreID not in self.toilState.jobsToBeScheduledWithMultiplePredecessors:
            self.toilState.jobsToBeScheduledWithMultiplePredecessors[successorJobStoreID] = self.jobStore.load(successorJobStoreID)
        successorJobGraph = self.toilState.jobsToBeScheduledWithMultiplePredecessors[successorJobStoreID]

        # Add the jobGraph as a finished predecessor to the successor
        successorJobGraph.predecessorsFinished.add(jobGraph.jobStoreID)

        # If the successor is in the set of successors of failed jobs
        if successorJobStoreID in self.toilState.failedSuccessors:
            if not self._handledFailedSuccessor(jobNode, jobGraph, successorJobStoreID):
                return False

        # If the successor job's predecessors have all not all completed then
        # ignore the jobGraph as is not yet ready to run
        assert len(successorJobGraph.predecessorsFinished) <= successorJobGraph.predecessorNumber
        if len(successorJobGraph.predecessorsFinished) < successorJobGraph.predecessorNumber:
            return False
        else:
            # Remove the successor job from the cache
            self.toilState.jobsToBeScheduledWithMultiplePredecessors.pop(successorJobStoreID)
            return True
254508
void selectJobsToInitialize() {
    for (String queue : jobQueues.keySet()) {
      ArrayList<JobInProgress> jobsToInitialize = getJobsToInitialize(queue);
      printJobs(jobsToInitialize);
      JobInitializationThread t = threadsToQueueMap.get(queue);
      for (JobInProgress job : jobsToInitialize) {
        t.addJobsToQueue(queue, job);
      }
    }
  }
467437
private void configureJobLevelMetrics(final JobRunner jobRunner) {
    this.logger.info("Configuring Azkaban metrics tracking for jobrunner object");
    if (MetricReportManager.isAvailable()) {
      final MetricReportManager metricManager = MetricReportManager.getInstance();

      // Adding NumRunningJobMetric listener
      jobRunner.addListener((NumRunningJobMetric) metricManager
          .getMetricFromName(NumRunningJobMetric.NUM_RUNNING_JOB_METRIC_NAME));

      // Adding NumFailedJobMetric listener
      jobRunner.addListener((NumFailedJobMetric) metricManager
          .getMetricFromName(NumFailedJobMetric.NUM_FAILED_JOB_METRIC_NAME));

    }

    jobRunner.addListener(JmxJobMBeanManager.getInstance());
  }
1173599
public void setJobs(java.util.Collection<ThirdPartyJob> jobs) {
        if (jobs == null) {
            this.jobs = null;
            return;
        }

        this.jobs = new java.util.ArrayList<ThirdPartyJob>(jobs);
    }
181835
protected void writeBranchCounts(final BranchCounts branch,
    final BitOutputStream out) throws IOException {
    final CodeType currentCodeType = this.getType(branch.path);
    long maximum = branch.size;
    assert maximum >= branch.terminals;
    if (currentCodeType == CodeType.Unknown) {
      this.writeTerminalCount(out, branch.terminals, maximum);
    }
    else if (currentCodeType == CodeType.Terminal) {
      assert branch.size == branch.terminals;
      assert 0 == branch.zeroCount;
      assert 0 == branch.oneCount;
    }
    else assert currentCodeType != CodeType.Prefix || 0 == branch.terminals;
    maximum -= branch.terminals;

    assert maximum >= branch.zeroCount;
    if (0 < maximum) {
      this.writeZeroBranchSize(out, branch.zeroCount, maximum, branch.path);
      maximum -= branch.zeroCount;
    }
    else {
      assert 0 == branch.zeroCount;
    }
    assert maximum == branch.oneCount;
  }
646036
void updateDrainedOrder(Task[] tasks, int maxTaskIndex) {
        if (maxTaskIndex >= 0) {
            Task task = tasks[maxTaskIndex];
            drainedOrder = task.getOrder() + 1;
        }
    }
1310272
public void setJobNames(java.util.Collection<String> jobNames) {
        if (jobNames == null) {
            this.jobNames = null;
            return;
        }

        this.jobNames = new java.util.ArrayList<String>(jobNames);
    }
929968
public void executeModelJobs(@Nonnull @MustNotContainNull final ModelJob... jobs) {
    Utils.safeSwingCall(new Runnable() {
      @Override
      public void run() {
        for (final ModelJob j : jobs) {
          try {
            if (!j.doChangeModel(model)) {
              break;
            }
          } catch (Exception ex) {
            LOGGER.error("Errot during job execution", ex);
          }
        }
        fireNotificationMindMapChanged(true);
      }
    });
  }
38373
public void setJobFlows(java.util.Collection<JobFlowDetail> jobFlows) {
        if (jobFlows == null) {
            this.jobFlows = null;
            return;
        }

        this.jobFlows = new com.amazonaws.internal.SdkInternalList<JobFlowDetail>(jobFlows);
    }
812666
public void setJobQueues(java.util.Collection<String> jobQueues) {
        if (jobQueues == null) {
            this.jobQueues = null;
            return;
        }

        this.jobQueues = new java.util.ArrayList<String>(jobQueues);
    }
327436
private void examineRedundantBranches() {
        for (RedundantBranch redundantBranch : redundantBranchList) {
            if (DEBUG) {
                System.out.println("Redundant branch: " + redundantBranch);
            }
            int lineNumber = redundantBranch.lineNumber;

            // The source to bytecode compiler may sometimes duplicate blocks of
            // code along different control paths. So, to report the bug,
            // we check to ensure that the branch is REALLY determined each
            // place it is duplicated, and that it is determined in the same
            // way.

            boolean confused = undeterminedBranchSet.get(lineNumber)
                    || (definitelySameBranchSet.get(lineNumber) && definitelyDifferentBranchSet.get(lineNumber));

            // confused if there is JSR confusion or multiple null checks with
            // different results on the same line

            boolean reportIt = true;

            if (lineMentionedMultipleTimes.get(lineNumber) && confused) {
                reportIt = false;
            } else if (redundantBranch.location.getBasicBlock().isInJSRSubroutine() /*
             * occurs
             * in
             * a
             * JSR
             */
                    && confused) {
                reportIt = false;
            } else {
                int pc = redundantBranch.location.getHandle().getPosition();
                for (CodeException e : method.getCode().getExceptionTable()) {
                    if (e.getCatchType() == 0 && e.getStartPC() != e.getHandlerPC() && e.getEndPC() <= pc
                            && pc <= e.getEndPC() + 5) {
                        reportIt = false;
                    }
                }
            }

            if (reportIt) {
                collector.foundRedundantNullCheck(redundantBranch.location, redundantBranch);
            }
        }
    }
1061079
def _handledFailedSuccessor(self, jobNode, jobGraph, successorJobStoreID):
        """"""
        logger.debug("Successor job: %s of job: %s has failed """
                     "predecessors", jobNode, jobGraph)

        # Add the job to the set having failed successors
        self.toilState.hasFailedSuccessors.add(jobGraph.jobStoreID)

        # Reduce active successor count and remove the successor as an active successor of the job
        self.toilState.successorCounts[jobGraph.jobStoreID] -= 1
        assert self.toilState.successorCounts[jobGraph.jobStoreID] >= 0
        self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID].remove(jobGraph)
        if len(self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID]) == 0:
            self.toilState.successorJobStoreIDToPredecessorJobs.pop(successorJobStoreID)

        # If the job now has no active successors add to active jobs
        # so it can be processed as a job with failed successors
        if self.toilState.successorCounts[jobGraph.jobStoreID] == 0:
            logger.debug("Job: %s has no successors to run "
                         "and some are failed, adding to list of jobs "
                         "with failed successors", jobGraph)
            self.toilState.successorCounts.pop(jobGraph.jobStoreID)
            self.toilState.updatedJobs.add((jobGraph, 0))
            return False
1098911
@Override
    public void requeue(Task task) {
        this.inprocess.remove(task);
        task.incrementAttempts();
        this.queue.add(task);
    }
811801
public void setJobs(java.util.Collection<JobDetail> jobs) {
        if (jobs == null) {
            this.jobs = null;
            return;
        }

        this.jobs = new java.util.ArrayList<JobDetail>(jobs);
    }
914068
public void setReplicationJobList(java.util.Collection<ReplicationJob> replicationJobList) {
        if (replicationJobList == null) {
            this.replicationJobList = null;
            return;
        }

        this.replicationJobList = new java.util.ArrayList<ReplicationJob>(replicationJobList);
    }