-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactor to make CDM Spark Native (#328)
* Made Partition into its own class & refactored stuff to make that work * Made CounterUnit its own class & refactored JobCounter to work with it. * Made JobType (Migrate, Validate & Guardrail) independent of track-run feature and renamed slices/partitions to PartitionRanges. Also provided actual jobs access to PartitionRange class. * Refactored code to be Spark Native, fixed metrics reporting & also improved trackRun feature. * Updated readme * Fixed metrics issue when trackRun was disabled.
- Loading branch information
1 parent
42a7148
commit 4b6f938
Showing
27 changed files
with
298 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/datastax/cdm/job/CDMMetricsAccumulator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright DataStax, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.datastax.cdm.job; | ||
|
||
import org.apache.spark.util.AccumulatorV2; | ||
|
||
import com.datastax.cdm.job.IJobSessionFactory.JobType; | ||
|
||
public class CDMMetricsAccumulator extends AccumulatorV2<JobCounter, JobCounter> { | ||
|
||
private static final long serialVersionUID = -4185304101452658315L; | ||
private JobCounter jobCounter; | ||
|
||
public CDMMetricsAccumulator(JobType jobType) { | ||
jobCounter = new JobCounter(jobType); | ||
} | ||
|
||
@Override | ||
public void add(JobCounter v) { | ||
jobCounter.add(v); | ||
} | ||
|
||
@Override | ||
public AccumulatorV2<JobCounter, JobCounter> copy() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean isZero() { | ||
return jobCounter.isZero(); | ||
} | ||
|
||
@Override | ||
public void merge(AccumulatorV2<JobCounter, JobCounter> other) { | ||
jobCounter.add(other.value()); | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
jobCounter.reset(); | ||
} | ||
|
||
@Override | ||
public JobCounter value() { | ||
return jobCounter; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.