From 85c7b0c5a6949c9ffd54d347fb38fdc434253b97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20Madon?= <mael.madon@irit.fr>
Date: Tue, 1 Feb 2022 15:52:18 +0100
Subject: [PATCH] campaign1 revert to original state, create campaign2

---
 campaign1.py |  7 +++----
 campaign2.py | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100755 campaign2.py

diff --git a/campaign1.py b/campaign1.py
index 1a966af..91d0681 100755
--- a/campaign1.py
+++ b/campaign1.py
@@ -17,16 +17,15 @@ random.seed(1997)
 
 nb_expe = 50
 
-
 start_dates = [random.randint(jun1, nov30 - 72 * 3600)
                for _ in range(nb_expe)]
 
-xp_a_relancer = [7, 26]
+#xp_a_relancer = [7, 26]
 
 with concurrent.futures.ProcessPoolExecutor() as executor:
     instances = []
-    # for i in range(nb_expe):
-    for i in xp_a_relancer:
+    for i in range(nb_expe):
+    # for i in xp_a_relancer:
         print(f"Submit expe {i}")
         # start_instance(expe_num, start_date, prepare_workload, clean_log)
         instances.append(executor.submit(start_instance, i, start_dates[i], False, True))
diff --git a/campaign2.py b/campaign2.py
new file mode 100755
index 0000000..364e8d9
--- /dev/null
+++ b/campaign2.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+
+import random
+from time import *
+import concurrent.futures
+
+from instance1 import start_instance
+
+# Prepare the start date samples
+begin_trace = 1356994806  # according to original SWF header
+jun1_unix_time = mktime(strptime('Sun Jun  1 00:00:00 2014'))
+nov30_unix_time = mktime(strptime('Sun Nov 30 23:59:59 2014'))
+jun1 = (int)(jun1_unix_time - begin_trace)
+nov30 = (int)(nov30_unix_time - begin_trace)
+
+random.seed(4186341)
+nb_expe = 50
+
+
+# TODO
+# We fix the demand response window to be at 16 on day 2
+
+
+# start_dates = [random.randint(jun1, nov30 - 72 * 3600)
+#                for _ in range(nb_expe)]
+
+# with concurrent.futures.ProcessPoolExecutor() as executor:
+#     instances = []
+#     for i in range(nb_expe):
+#         print(f"Submit expe {i}")
+#         # start_instance(expe_num, start_date, prepare_workload, clean_log)
+#         instances.append(executor.submit(
+#             start_instance, i, start_dates[i], False, True))
+
+#     for instance in concurrent.futures.as_completed(instances):
+#         print(f"Expe {instance.result()} terminated")
-- 
GitLab