-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
592 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dataflow.model.job; | ||
|
||
import java.util.List; | ||
|
||
import dataflow.model.mapper.Mapper; | ||
import dataflow.model.reducer.Reducer; | ||
|
||
public class Job { | ||
|
||
private Mapper mappers; | ||
private Reducer reducers; | ||
|
||
public void setMappsers(List<Mapper> mappers) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
public void setReducers(List<Reducer> reducers2) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
} |
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,42 @@ | ||
package dataflow.model.job; | ||
|
||
import java.util.List; | ||
|
||
import dataflow.model.mapper.Mapper; | ||
import dataflow.model.reducer.Reducer; | ||
import profile.job.JobProfile; | ||
import profile.profiler.JobProfileFromSerialization; | ||
|
||
public class JobDataflowModelBuilder { | ||
|
||
|
||
public static void main(String[] args) { | ||
String jobId = "job_201403261726_0001"; | ||
|
||
String serializeDir = "/Users/xulijie/Documents/DiagOOMSpace/PigMapJoin/"; | ||
|
||
JobProfile jobProfile = JobProfileFromSerialization.deserialization(serializeDir, jobId); | ||
|
||
Job job = buildDataflow(jobProfile); | ||
|
||
/* | ||
System.out.println("## Mapper"); | ||
System.out.println(job.getMapperInfoList().get(0)); | ||
System.out.println("\n## Reducer"); | ||
System.out.println(job.getReducerInfoList().get(0)); | ||
*/ | ||
} | ||
|
||
public static Job buildDataflow(JobProfile jobProfile) { | ||
List<Mapper> mappers = MapperDataflowBuilder.build(jobProfile); | ||
List<Reducer> reducers = ReducerDataflowBuilder.build(jobProfile, mappers); | ||
|
||
Job job = new Job(); | ||
job.setMappsers(mappers); | ||
job.setReducers(reducers); | ||
|
||
return job; | ||
} | ||
|
||
} |
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,32 @@ | ||
package dataflow.model.job; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import dataflow.model.mapper.Mapper; | ||
import profile.job.JobProfile; | ||
import profile.mapper.MapperInfo; | ||
|
||
public class MapperDataflowBuilder { | ||
|
||
public static List<Mapper> build(JobProfile jobProfile) { | ||
|
||
List<Mapper> mappers = new ArrayList<Mapper>(); | ||
|
||
for(MapperInfo info : jobProfile.getMapperInfoList()) { | ||
Mapper mapper = new Mapper(jobProfile.getJobConfiguration()); | ||
|
||
mapper.setBasicInfo(info.getTaskId(), info.isMapRunning(), info.getRunningPhase()); | ||
mapper.setInputSplit(info.getInput()); | ||
mapper.setSpillBuffer(info.getBuffer()); | ||
mapper.setSpills(info.getSpill(), info.getCounters()); | ||
mapper.setMerges(info.getMerge(), info.getCounters()); | ||
|
||
mappers.add(mapper); | ||
} | ||
|
||
return mappers; | ||
} | ||
|
||
} | ||
|
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,33 @@ | ||
package dataflow.model.job; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import profile.job.JobProfile; | ||
import profile.reducer.ReducerInfo; | ||
import dataflow.model.mapper.Mapper; | ||
import dataflow.model.reducer.Reducer; | ||
|
||
|
||
public class ReducerDataflowBuilder { | ||
|
||
public static List<Reducer> build(JobProfile jobProfile, List<Mapper> mappers) { | ||
List<Reducer> reducers = new ArrayList<Reducer>(); | ||
|
||
for(ReducerInfo info : jobProfile.getReducerInfoList()) { | ||
|
||
Reducer reducer = new Reducer(jobProfile.getJobConfiguration()); | ||
|
||
reducer.setBasicInfo(info.getTaskId(), info.getRunningPhase(), info.isInMemMergeRunning()); | ||
reducer.setShuffle(mappers, info.getShuffle(), info.getShuffleBuffer(), info.getMergeInShuffle()); | ||
reducer.setMergeCombineFunc(info.getMergeInShuffle(), info.getReducerCounters()); | ||
reducer.setSegmentInRedeuceBuffer(info.getSort()); | ||
reducer.setReduce(info.getReducerCounters()); | ||
|
||
reducers.add(reducer); | ||
} | ||
|
||
return reducers; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
package dataflow.model.reducer; | ||
|
||
public class MergeCombineFunc { | ||
private long combineInputRecords; | ||
private long combineInputBytes; | ||
|
||
private long combineOutputRecords; | ||
private long combineOutputBytes; | ||
private long cCombineInputRecords; | ||
|
||
private long cCombineOutputRecords; | ||
|
||
private long tCombineInputRecords; | ||
|
||
public long getcCombineInputRecords() { | ||
return cCombineInputRecords; | ||
} | ||
|
||
public void setcCombineInputRecords(long cCombineInputRecords) { | ||
this.cCombineInputRecords = cCombineInputRecords; | ||
} | ||
|
||
public long getcCombineOutputRecords() { | ||
return cCombineOutputRecords; | ||
} | ||
|
||
public void setcCombineOutputRecords(long cCombineOutputRecords) { | ||
this.cCombineOutputRecords = cCombineOutputRecords; | ||
} | ||
|
||
public long gettCombineInputRecords() { | ||
return tCombineInputRecords; | ||
} | ||
|
||
public void settCombineInputRecords(long tCombineInputRecords) { | ||
this.tCombineInputRecords = tCombineInputRecords; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,10 +1,43 @@ | ||
package dataflow.model.reducer; | ||
|
||
public class ReduceFunc { | ||
private long reduceInputRecords; | ||
private long reduceInputBytes; | ||
private long tReduceInputRecords; | ||
|
||
private long reduceOutputRecords; | ||
private long reduceOutputBytes; | ||
private long cReduceInputRecords; | ||
private long cReduceInputGroups; | ||
|
||
private long cReduceOutputRecords; | ||
|
||
public long gettReduceInputRecords() { | ||
return tReduceInputRecords; | ||
} | ||
|
||
public void settReduceInputRecords(long tReduceInputRecords) { | ||
this.tReduceInputRecords = tReduceInputRecords; | ||
} | ||
|
||
public long getcReduceInputRecords() { | ||
return cReduceInputRecords; | ||
} | ||
|
||
public void setcReduceInputRecords(long cReduceInputRecords) { | ||
this.cReduceInputRecords = cReduceInputRecords; | ||
} | ||
|
||
public long getcReduceInputGroups() { | ||
return cReduceInputGroups; | ||
} | ||
|
||
public void setcReduceInputGroups(long cReduceInputGroups) { | ||
this.cReduceInputGroups = cReduceInputGroups; | ||
} | ||
|
||
public long getcReduceOutputRecords() { | ||
return cReduceOutputRecords; | ||
} | ||
|
||
public void setcReduceOutputRecords(long cReduceOutputRecords) { | ||
this.cReduceOutputRecords = cReduceOutputRecords; | ||
} | ||
|
||
} |
Oops, something went wrong.