Repository: bigtop
Updated Branches:
  refs/heads/master b7e369edd -> 539760dd5


BIGTOP-1674. [BigPetStore] Drop first 7 days of transactions to account for 
simulation burn-in time.


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/539760dd
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/539760dd
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/539760dd

Branch: refs/heads/master
Commit: 539760dd5f7150893f15cd992ada8502204145bd
Parents: b7e369e
Author: RJ Nowling <[email protected]>
Authored: Mon Feb 16 22:10:54 2015 -0600
Committer: jayunit100 <[email protected]>
Committed: Tue Feb 17 10:48:32 2015 -0500

----------------------------------------------------------------------
 .../apache/bigpetstore/spark/generator/SparkDriver.scala    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/539760dd/bigtop-bigpetstore/bigpetstore-spark/src/main/scala/org/apache/bigpetstore/spark/generator/SparkDriver.scala
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-spark/src/main/scala/org/apache/bigpetstore/spark/generator/SparkDriver.scala
 
b/bigtop-bigpetstore/bigpetstore-spark/src/main/scala/org/apache/bigpetstore/spark/generator/SparkDriver.scala
index 7649c48..f86360e 100644
--- 
a/bigtop-bigpetstore/bigpetstore-spark/src/main/scala/org/apache/bigpetstore/spark/generator/SparkDriver.scala
+++ 
b/bigtop-bigpetstore/bigpetstore-spark/src/main/scala/org/apache/bigpetstore/spark/generator/SparkDriver.scala
@@ -48,6 +48,7 @@ object SparkDriver {
   private var seed: Long = -1
   private var outputDir: String = ""
   private val NPARAMS = 5
+  private val BURNIN_TIME = 7.0 // days
 
   private def printUsage() {
     val usage: String =
@@ -158,17 +159,19 @@ object SparkDriver {
         val seedFactory = new SeedFactory(nextSeed ^ index)
         val transactionIter = custIter.map{
         customer =>
-               val products = productBC.value
+         val products = productBC.value
           //Create a new purchasing profile.
           val profileGen = new PurchasingProfileGenerator(products, 
seedFactory)
           val profile = profileGen.generate()
           val transGen = new TransactionGenerator(customer, profile, 
storesBC.value, products, seedFactory)
           var transactions : List[Transaction] = List()
-               var transaction = transGen.generate()
+         var transaction = transGen.generate()
 
           //Create a list of this customer's transactions for the time period
           while(transaction.getDateTime() < simulationLength) {
-            transactions = transaction :: transactions
+            if (transaction.getDateTime > BURNIN_TIME) {
+              transactions = transaction :: transactions
+            }
             transaction = transGen.generate()
           }
           //The final result, we return the list of transactions produced 
above.

Reply via email to