Skip to content

Commit 9cd4a1a

Browse files
committed
Merge branch 'master' into dev_partitions
Conflicts: src/main/java/ldbc/socialnet/dbgen/generator/MRGenerateUsers.java
2 parents 71990da + b5250b4 commit 9cd4a1a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main/java/ldbc/socialnet/dbgen/generator/MRGenerateUsers.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ protected void setup(Context context){
106106
Path outFile = new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".csv");
107107
out = fs.create(outFile);
108108
}
109-
properties = fs.create(new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".properties"));
109+
if (conf.getBoolean("updateStreams",false)) {
110+
properties = fs.create(new Path(context.getConfiguration().get("outputDir")+"/social_network/updateStream_"+attempTaskId+"_"+partitionId+"_"+streamType+".properties"));
111+
}
110112
} catch (IOException e) {
111113
e.printStackTrace();
112114
}
@@ -127,10 +129,13 @@ public void reduce(LongWritable key, Iterable<Text> valueSet,
127129
protected void cleanup(Context context){
128130
try {
129131
System.out.println("Number of events reduced "+numEvents);
130-
String propertiesStr = new String("gctdeltaduration:"+context.getConfiguration().get("deltaTime")+"\nmin_write_event_start_time:"+min+"\nmax_write_event_start_time:"+max+"\nupdate_interleave:"+(max-min)/numEvents);
131-
properties.write(propertiesStr.getBytes("UTF8"));
132-
properties.flush();
133-
properties.close();
132+
if (numEvents > 0) {
133+
long updateDistance = (max-min)/numEvents;
134+
String propertiesStr = new String("gctdeltaduration:"+context.getConfiguration().get("deltaTime")+"\nmin_write_event_start_time:"+min+"\nmax_write_event_start_time:"+max+"\nupdate_interleave:"+updateDistance);
135+
properties.write(propertiesStr.getBytes("UTF8"));
136+
properties.flush();
137+
properties.close();
138+
}
134139
out.flush();
135140
out.close();
136141
} catch (IOException e) {

0 commit comments

Comments
 (0)