Search in sources :

Example 1 with StageInfo

use of org.apache.spark.scheduler.StageInfo in project kylo by Teradata.

the class Job method onStageProgress.

/**
 * Sets the job progress for the specified stage.
 *
 * @param stage          the current stage
 * @param tasksCompleted the number of completed tasks
 */
public void onStageProgress(@Nonnull final StageInfo stage, final int tasksCompleted) {
    int sum = 0;
    for (final StageInfo previousStage : stages) {
        if (previousStage.stageId() < stage.stageId()) {
            sum += previousStage.numTasks();
        }
    }
    this.tasksCompleted.set(sum + tasksCompleted);
}
Also used : StageInfo(org.apache.spark.scheduler.StageInfo)

Example 2 with StageInfo

use of org.apache.spark.scheduler.StageInfo in project kylo by Teradata.

the class Job method setStages.

/**
 * Sets the Spark stages.
 */
public void setStages(@Nonnull final List<StageInfo> stages) {
    this.stages = stages;
    tasksCompleted.set(0);
    int sum = 0;
    for (final StageInfo stage : stages) {
        sum += stage.numTasks();
    }
    tasksTotal.set(sum);
}
Also used : StageInfo(org.apache.spark.scheduler.StageInfo)

Example 3 with StageInfo

use of org.apache.spark.scheduler.StageInfo in project kylo by Teradata.

the class JobTrackerService method createCache.

/**
 * Creates a job cache.
 */
@Nonnull
private Cache<String, Job<?>> createCache() {
    final Cache<String, Job<?>> cache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).removalListener(new RemovalListener<String, Job<?>>() {

        @Override
        public void onRemoval(@Nonnull final RemovalNotification<String, Job<?>> notification) {
            // noinspection ConstantConditions
            final Optional<Integer> jobId = notification.getValue().getJobId();
            if (jobId.isPresent()) {
                jobs.remove(jobId.get());
            }
            for (final StageInfo stage : notification.getValue().getStages()) {
                stages.remove(stage.stageId());
            }
        // TODO remove temp table
        }
    }).build();
    // Schedule clean-up of groups
    executor.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            groups.cleanUp();
        }
    }, 1, 1, TimeUnit.HOURS);
    return cache;
}
Also used : Nonnull(javax.annotation.Nonnull) StageInfo(org.apache.spark.scheduler.StageInfo) RemovalNotification(com.google.common.cache.RemovalNotification) SaveJob(com.thinkbiganalytics.spark.metadata.SaveJob) Job(com.thinkbiganalytics.spark.metadata.Job) SparkJob(com.thinkbiganalytics.spark.metadata.SparkJob) TransformJob(com.thinkbiganalytics.spark.metadata.TransformJob) RemovalListener(com.google.common.cache.RemovalListener) Nonnull(javax.annotation.Nonnull)

Example 4 with StageInfo

use of org.apache.spark.scheduler.StageInfo in project kylo by Teradata.

the class JobTrackerService method onJobEnd.

@Override
public void onJobEnd(@Nonnull final SparkListenerJobEnd event) {
    log.trace("Job {} ended", event.jobId());
    final Job<?> job = jobs.remove(event.jobId());
    if (job != null) {
        job.onJobEnd();
        for (final StageInfo stage : job.getStages()) {
            stages.remove(stage.stageId());
        }
    }
}
Also used : StageInfo(org.apache.spark.scheduler.StageInfo)

Aggregations

StageInfo (org.apache.spark.scheduler.StageInfo)4 RemovalListener (com.google.common.cache.RemovalListener)1 RemovalNotification (com.google.common.cache.RemovalNotification)1 Job (com.thinkbiganalytics.spark.metadata.Job)1 SaveJob (com.thinkbiganalytics.spark.metadata.SaveJob)1 SparkJob (com.thinkbiganalytics.spark.metadata.SparkJob)1 TransformJob (com.thinkbiganalytics.spark.metadata.TransformJob)1 Nonnull (javax.annotation.Nonnull)1