Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Demand Response User
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
Open Science
Demand Response User
Commits
6d77b896
Commit
6d77b896
authored
3 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
campaign1 ready to be launched with 2 expe for testing
parent
f0f1f9db
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
campaign1.py
+5
-12
5 additions, 12 deletions
campaign1.py
instance1.py
+24
-13
24 additions, 13 deletions
instance1.py
passive_submit.sh
+6
-0
6 additions, 0 deletions
passive_submit.sh
scripts/install_nix.sh
+1
-1
1 addition, 1 deletion
scripts/install_nix.sh
with
37 additions
and
27 deletions
.gitignore
+
1
−
1
View file @
6d77b896
...
@@ -2,7 +2,7 @@ sched_input/*.json
...
@@ -2,7 +2,7 @@ sched_input/*.json
workload/*
workload/*
!workload/empty_workload.json
!workload/empty_workload.json
*.ipynb_checkpoints
*.ipynb_checkpoints
*
/
__pycache__/
*__pycache__/
out/*
out/*
cache_nix
cache_nix
This diff is collapsed.
Click to expand it.
campaign1.py
+
5
−
12
View file @
6d77b896
...
@@ -5,7 +5,6 @@ import concurrent.futures
...
@@ -5,7 +5,6 @@ import concurrent.futures
from
instance1
import
start_instance
from
instance1
import
start_instance
# Prepare the start date samples
# Prepare the start date samples
begin_trace
=
1356994806
# according to original SWF header
begin_trace
=
1356994806
# according to original SWF header
jun1_unix_time
,
nov30_unix_time
=
mktime
(
strptime
(
jun1_unix_time
,
nov30_unix_time
=
mktime
(
strptime
(
'
Sun Jun 1 00:00:00 2014
'
)),
mktime
(
strptime
(
'
Sun Nov 30 23:59:59 2014
'
))
'
Sun Jun 1 00:00:00 2014
'
)),
mktime
(
strptime
(
'
Sun Nov 30 23:59:59 2014
'
))
...
@@ -17,23 +16,17 @@ random.seed(1997)
...
@@ -17,23 +16,17 @@ random.seed(1997)
nb_expe
=
2
nb_expe
=
2
def
print_two
(
a
,
b
):
print
(
a
,
b
)
sleep
(
3
)
print
(
"
hello
"
)
return
0
start_dates
=
[
random
.
randint
(
jun1
,
nov30
-
72
*
3600
)
start_dates
=
[
random
.
randint
(
jun1
,
nov30
-
72
*
3600
)
for
_
in
range
(
nb_expe
)]
for
_
in
range
(
nb_expe
)]
with
concurrent
.
futures
.
ProcessPoolExecutor
()
as
executor
:
with
concurrent
.
futures
.
ProcessPoolExecutor
()
as
executor
:
instances
=
[]
instances
=
[
executor
.
submit
(
start_instance
,
i
,
start_dates
[
i
])
for
i
in
range
(
nb_expe
):
for
i
in
range
(
nb_expe
)]
print
(
f
"
Submit expe
{
i
}
"
)
instances
.
append
(
executor
.
submit
(
start_instance
,
i
,
start_dates
[
i
],
True
,
True
))
for
instance
in
concurrent
.
futures
.
as_completed
(
instances
):
for
instance
in
concurrent
.
futures
.
as_completed
(
instances
):
print
(
instance
.
result
())
print
(
f
"
Expe
{
instance
.
result
()
}
terminated
"
)
# For every start date
# For every start date
# Call the one_instance file with this date
# Call the one_instance file with this date
This diff is collapsed.
Click to expand it.
instance1.py
+
24
−
13
View file @
6d77b896
...
@@ -28,8 +28,9 @@ def prepare_input_data(expe_num, start_date):
...
@@ -28,8 +28,9 @@ def prepare_input_data(expe_num, start_date):
job_walltime_factor
=
8
)
job_walltime_factor
=
8
)
def
run_expe
(
expe_num
,
user_category
,
window_size
):
def
run_expe
(
expe_num
,
user_category
,
window_size
,
clean_log
):
"""
Run batmen with given behavior and demand response window
"""
"""
Run batmen with given behavior and demand response window.
Expe_num should be a small integer (eg < 100)
"""
# Useful vars and output folder
# Useful vars and output folder
if
window_size
==
0.5
:
if
window_size
==
0.5
:
w_size
=
'
05
'
w_size
=
'
05
'
...
@@ -62,24 +63,34 @@ def run_expe(expe_num, user_category, window_size):
...
@@ -62,24 +63,34 @@ def run_expe(expe_num, user_category, window_size):
json
.
dump
(
data
,
user_description_file
)
json
.
dump
(
data
,
user_description_file
)
# Generate and run robin instance
# Generate and run robin instance
socket_batsim
=
f
"
tcp://localhost:280
{
expe_num
:
02
d
}
"
socket_batsched
=
f
"
tcp://*:280
{
expe_num
:
02
d
}
"
batcmd
=
gen_batsim_cmd
(
batcmd
=
gen_batsim_cmd
(
pf
,
wl
,
EXPE_DIR
,
"
--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse
"
)
pf
,
wl
,
EXPE_DIR
,
f
"
--socket-endpoint=
{
socket_batsim
}
--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse
"
)
schedcmd
=
f
"
batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath=
{
uf
}
"
schedcmd
=
f
"
batsched
--socket-endpoint=
{
socket_batsched
}
-v bin_packing_energy --queue_order=desc_size --variant_options_filepath=
{
uf
}
"
instance
=
RobinInstance
(
output_dir
=
EXPE_DIR
,
instance
=
RobinInstance
(
output_dir
=
EXPE_DIR
,
batcmd
=
batcmd
,
batcmd
=
batcmd
,
schedcmd
=
schedcmd
,
schedcmd
=
schedcmd
,
simulation_timeout
=
3
0
,
ready_timeout
=
5
,
simulation_timeout
=
60480
0
,
ready_timeout
=
10
,
success_timeout
=
1
0
,
failure_timeout
=
0
success_timeout
=
360
0
,
failure_timeout
=
5
)
)
instance
.
to_file
(
EXPE_FILE
)
instance
.
to_file
(
EXPE_FILE
)
print
(
f
"
before ru
n
{
EXPE_FILE
}
"
)
print
(
f
"
Run robi
n
{
EXPE_FILE
}
"
)
ret
=
run_robin
(
EXPE_FILE
)
ret
=
run_robin
(
EXPE_FILE
)
print
(
f
"
after ru
n
{
EXPE_FILE
}
"
)
print
(
f
"
Robi
n
{
EXPE_FILE
}
finished
"
)
# Remove the log files that can quickly become heavy...
if
clean_log
:
os
.
remove
(
f
"
{
EXPE_DIR
}
/log/batsim.log
"
)
os
.
remove
(
f
"
{
EXPE_DIR
}
/log/sched.err.log
"
)
os
.
remove
(
f
"
{
EXPE_DIR
}
/log/sched.out.log
"
)
def
start_instance
(
expe_num
,
start_date
):
def
start_instance
(
expe_num
,
start_date
,
prepare_workload
=
True
,
clean_log
=
False
):
# Prepare workload
# Prepare workload
#prepare_input_data(expe_num, start_date)
if
prepare_workload
:
prepare_input_data
(
expe_num
,
start_date
)
# Create expe folder
# Create expe folder
if
not
os
.
path
.
exists
(
f
"
{
ROOT_DIR
}
/out/expe
{
expe_num
}
"
):
if
not
os
.
path
.
exists
(
f
"
{
ROOT_DIR
}
/out/expe
{
expe_num
}
"
):
...
@@ -88,18 +99,18 @@ def start_instance(expe_num, start_date):
...
@@ -88,18 +99,18 @@ def start_instance(expe_num, start_date):
# Run with Rigid behavior (the demand response window has no influence here)
# Run with Rigid behavior (the demand response window has no influence here)
run_expe
(
expe_num
=
expe_num
,
run_expe
(
expe_num
=
expe_num
,
user_category
=
"
replay_user_rigid
"
,
user_category
=
"
replay_user_rigid
"
,
window_size
=
1
)
window_size
=
1
,
clean_log
=
clean_log
)
# 4*4 = 16 expe
# 4*4 = 16 expe
for
behavior
in
[
"
dm_user_reconfig
"
,
"
dm_user_degrad
"
,
for
behavior
in
[
"
dm_user_reconfig
"
,
"
dm_user_degrad
"
,
"
dm_user_renonce
"
,
"
dm_user_delay
"
]:
"
dm_user_renonce
"
,
"
dm_user_delay
"
]:
for
window_size
in
[
0.5
,
1
,
2
,
4
]:
for
window_size
in
[
0.5
,
1
,
2
,
4
]:
run_expe
(
expe_num
,
behavior
,
window_size
)
run_expe
(
expe_num
,
behavior
,
window_size
,
clean_log
=
clean_log
)
###### Output data treatment ######
###### Output data treatment ######
# Produce the utilisation viz?
# Produce the utilisation viz?
return
0
return
expe_num
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
...
...
This diff is collapsed.
Click to expand it.
passive_submit.sh
0 → 100755
+
6
−
0
View file @
6d77b896
#!/bin/bash
cd
~/demand-response-user
source
scripts/install_nix.sh
nix-shell
--pure
-A
exp_env
--run
"python3 campaign1.py"
This diff is collapsed.
Click to expand it.
scripts/install_nix.sh
100644 → 100755
+
1
−
1
View file @
6d77b896
...
@@ -3,5 +3,5 @@ cd ~/demand-response-user
...
@@ -3,5 +3,5 @@ cd ~/demand-response-user
sudo-g5k
sudo-g5k
sudo
su root
--command
"echo 1 > /proc/sys/kernel/unprivileged_userns_clone"
sudo
su root
--command
"echo 1 > /proc/sys/kernel/unprivileged_userns_clone"
curl https://nixos.org/releases/nix/nix-2.6.0/install | sh
curl https://nixos.org/releases/nix/nix-2.6.0/install | sh
.
${
HOME
}
/.nix-profile/etc/profile.d/nix.sh
source
${
HOME
}
/.nix-profile/etc/profile.d/nix.sh
nix-store
--import
< cache_nix
nix-store
--import
< cache_nix
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment