|
37 | 37 | package ldbc.socialnet.dbgen.generator;
|
38 | 38 |
|
39 | 39 | import java.io.*;
|
| 40 | +import java.util.Properties; |
40 | 41 | import java.util.TreeSet;
|
41 | 42 | import java.util.zip.GZIPOutputStream;
|
42 | 43 |
|
@@ -131,7 +132,11 @@ protected void cleanup(Context context){
|
131 | 132 | System.out.println("Number of events reduced "+numEvents);
|
132 | 133 | if (numEvents > 0) {
|
133 | 134 | 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 | + String propertiesStr = new String("gctdeltaduration:"+context.getConfiguration().get("deltaTime")+ |
| 136 | + "\nmin_write_event_start_time:"+min+ |
| 137 | + "\nmax_write_event_start_time:"+max+ |
| 138 | + "\nupdate_interleave:"+updateDistance+ |
| 139 | + "\nnum_events:"+numEvents); |
135 | 140 | properties.write(propertiesStr.getBytes("UTF8"));
|
136 | 141 | properties.flush();
|
137 | 142 | properties.close();
|
@@ -538,6 +543,10 @@ public int runGenerateJob(Configuration conf) throws Exception {
|
538 | 543 | int resUpdateStreams = job4.waitForCompletion(true) ? 0 : 1;
|
539 | 544 | fs.delete(new Path(hadoopDir + "/sib4"),true);
|
540 | 545 |
|
| 546 | + int numEvents = 0; |
| 547 | + long min = Long.MAX_VALUE; |
| 548 | + long max = Long.MIN_VALUE; |
| 549 | + |
541 | 550 | for( int i =0; i < numThreads; ++i ) {
|
542 | 551 | int numPartitions = conf.getInt("numUpdatePartitions", 1);
|
543 | 552 | for( int j = 0; j < numPartitions; ++j ) {
|
@@ -585,15 +594,47 @@ public int runGenerateJob(Configuration conf) throws Exception {
|
585 | 594 | jobPerson.waitForCompletion(true);
|
586 | 595 | fs.delete(new Path(socialNetDir + "/temp_updateStream_" + i+"_"+j+"_person"), false);
|
587 | 596 | fs.delete(new Path(hadoopDir + "/sibEnd"), true);
|
| 597 | + |
| 598 | + if(conf.getBoolean("updateStreams",false)) { |
| 599 | + Properties properties = new Properties(); |
| 600 | + properties.load(fs.open(new Path(conf.get("outputDir") + "/social_network/updateStream_" + i + "_" + j + "_person.properties"))); |
| 601 | + Long auxMin = Long.parseLong(properties.getProperty("min_write_event_start_time")); |
| 602 | + min = auxMin < min ? auxMin : min; |
| 603 | + Long auxMax = Long.parseLong(properties.getProperty("max_write_event_start_time")); |
| 604 | + max = auxMax > max ? auxMax : max; |
| 605 | + numEvents += Long.parseLong(properties.getProperty("num_events")); |
| 606 | + |
| 607 | + properties.load(fs.open(new Path(conf.get("outputDir") + "/social_network/updateStream_" + i + "_" + j + "_forum.properties"))); |
| 608 | + |
| 609 | + auxMin = Long.parseLong(properties.getProperty("min_write_event_start_time")); |
| 610 | + min = auxMin < min ? auxMin : min; |
| 611 | + auxMax = Long.parseLong(properties.getProperty("max_write_event_start_time")); |
| 612 | + max = auxMax > max ? auxMax : max; |
| 613 | + numEvents += Long.parseLong(properties.getProperty("num_events")); |
| 614 | + |
| 615 | + fs.delete(new Path(conf.get("outputDir") + "/social_network/updateStream_" + i + "_" + j + "_person.properties"),true); |
| 616 | + fs.delete(new Path(conf.get("outputDir") + "/social_network/updateStream_" + i + "_" + j + "_forum.properties"),true); |
| 617 | + } |
588 | 618 | }
|
589 | 619 | }
|
590 | 620 |
|
| 621 | + if(conf.getBoolean("updateStreams",false)) { |
| 622 | + OutputStream output = fs.create(new Path(conf.get("outputDir") + "/social_network/updateStream.properties")); |
| 623 | + output.write(new String("gctdeltaduration:"+conf.get("deltaTime")+"\n").getBytes()); |
| 624 | + output.write(new String("min_write_event_start_time:"+min+"\n").getBytes()); |
| 625 | + output.write(new String("max_write_event_start_time:"+max+"\n").getBytes()); |
| 626 | + output.write(new String("update_interleave:"+(max-min)/numEvents+"\n").getBytes()); |
| 627 | + output.write(new String("num_events:"+numEvents).getBytes()); |
| 628 | + output.close(); |
| 629 | + } |
| 630 | + |
| 631 | + |
| 632 | + |
591 | 633 | printProgress("Starting: Materialize friends for substitution parameters");
|
592 | 634 | int resMaterializeFriends = job6.waitForCompletion(true) ? 0 : 1;
|
593 | 635 | fs.delete(new Path(hadoopDir + "/sibSorting3"),true);
|
594 | 636 |
|
595 | 637 |
|
596 |
| - |
597 | 638 | long end = System.currentTimeMillis();
|
598 | 639 | System.out.println(((end - start) / 1000)
|
599 | 640 | + " total seconds");
|
|
0 commit comments