Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 2e266458 authored by Millian Poquet's avatar Millian Poquet
Browse files

[clean] remove old tests

These tests have not been used for long. CI uses batexpe now.
parent c36d669a
#!/usr/bin/env python
"""Clean previous results of an output directory."""
import argparse
import os
import shutil
def clean_output_directory(directory):
"""Clean an output directory."""
if os.path.isdir(directory):
subdirs = [directory + '/' + x for x in ['instances', 'sweeper',
'results']]
for subdir in subdirs:
if os.path.isdir(subdir):
shutil.rmtree(subdir)
def main():
"""Entry point. Parses input arguments and calls clean_output_directory."""
parser = argparse.ArgumentParser(description='Cleans a batsim execN '
'output directory')
parser.add_argument('dir',
type=str,
help='The directory to clean')
args = parser.parse_args()
clean_output_directory(args.dir)
if __name__ == "__main__":
main()
#!/usr/bin/env python
"""Checks whether a directory looks like Batsim root directory."""
import argparse
import os
import sys
def looks_like_batsim_dir(directory):
"""Return whether the directory looks like Batsim root directory."""
if os.path.isdir(directory):
subdirs = [directory + '/' + x for x in ['cmake', 'platforms',
'schedulers', 'src', 'tools']]
for subdir in subdirs:
if not os.path.isdir(subdir):
print("Directory '{dir}' does not look like the "
"Batsim root one : the '{subdir}' subdirectory does not "
"exist.".format(dir=directory, subdir=subdir))
return False
print("Directory '{}' looks like the Batsim root one"
.format(directory))
return True
else:
print("Directory '{}' does not exist!".format(directory))
return False
def main():
"""Entry point. Parses input arguments then calls looks_like_batsim_dir."""
parser = argparse.ArgumentParser(description='Checks whether a directory '
'seems to be the Batsim root one')
parser.add_argument('dir',
type=str,
help='The directory to check')
args = parser.parse_args()
if looks_like_batsim_dir(args.dir):
sys.exit(0)
else:
sys.exit(1)
if __name__ == "__main__":
main()
base_output_directory: /tmp/pybatsim_tests/
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"homo128", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml"}
workload :
- {"name":"tiny", "filename":"${batsim_dir}/workloads/test_workload_profile.json"}
- {"name":"medium", "filename":"${batsim_dir}/workloads/batsim_paper_workload_example.json"}
pybatsim_algo:
- {"name":"filler", "algo_name":"fillerSched"}
- {"name":"easy", "algo_name":"easyBackfill"}
- {"name":"easy_no_topo", "algo_name":"easyBackfillNotopo"}
energy_string: ['', '-E']
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${instance_id}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -e ${output_directory}/out --mmax-workload ${energy_string}
sched_command: ${PYBATSIM_BIN:=pybatsim} ${pybatsim_algo[algo_name]}
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/batexec
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"small", "filename":"${batsim_dir}/platforms/small_platform.xml"}
workload :
- {"name":"tiny", "filename":"${batsim_dir}/workloads/test_workload_profile.json"}
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${workload[name]}_${platform[name]}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -e ${output_directory}/out --mmax-workload --batexec
sched_command: echo "I do not even exist."
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/demo
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"homo128", "filename":"${base_output_directory}/platform.xml"}
workload :
- {"name":"medium", "filename":"${base_output_directory}/workload.json"}
algo: ["filler", "easy_bf"]
generic_instance:
timeout: 10 # The instance is killed if it takes more than 10 seconds
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/${algo}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -e ${output_directory}/out --mmax-workload
sched_command: ${BATSCHED_BIN:=batsched} -v ${algo}
# These post commands are executed after each instance
post_commands:
# Information about jobs
- |
#!/usr/bin/env bash
cat ${output_directory}/analysis.R << EOF
#!/usr/bin/env Rscript
library(dplyr)
library(ggplot2)
jobs = read.csv('${output_directory}/out_jobs.csv')
summary(jobs)
pdf('${output_directory}/scatter_wait_sub.pdf')
jobs %>% ggplot(aes(x=submission_time, y=waiting_time)) + geom_point()
dev.off()
pdf('${output_directory}/hist_wait.pdf')
jobs %>% ggplot(aes(x=waiting_time)) + geom_histogram()
dev.off()
EOF
- chmod +x ${output_directory}/analysis.R
- ${output_directory}/analysis.R
# These pre commands are done before executing any instance
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
- cp ${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml ${base_output_directory}/platform.xml
- cp ${batsim_dir}/workloads/batsim_paper_workload_example.json ${base_output_directory}/workload.json
# These post commands are done once all instances have been executed
commands_after_instances:
# Visualize results with Evalys
- |
#!/usr/bin/env bash
cat > ${base_output_directory}/analysis.py << EOF
#!/usr/bin/env python3
from evalys import *
from evalys.jobset import *
from evalys.visu import *
import matplotlib.pyplot as plt
easy = JobSet.from_csv('${base_output_directory}/easy_bf/out_jobs.csv')
filler = JobSet.from_csv('${base_output_directory}/filler/out_jobs.csv')
fig, ax_list = plt.subplots(2, sharex = True, sharey = False)
plot_gantt(easy, ax=ax_list[0], title="Easy Backfilling", labels=False)
plot_gantt(filler, ax=ax_list[1], title="Filler", labels=False)
plt.savefig('${base_output_directory}/gantts.png')
EOF
- chmod +x ${base_output_directory}/analysis.py
- ${base_output_directory}/analysis.py
# Visualize results with ViTE
- vite ${base_output_directory}/easy_bf/out_schedule.trace -e ${base_output_directory}/easy_bf/trace.svg
base_output_directory: /tmp/batsim_tests/dynamic_submit
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
# Algorithms without parameters
noparam:
sweep:
platform :
# Disabled as long obfh is not solved (https://github.com/oar-team/batsim/issues/21)
#- {"name":"homo1", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_1.xml", "master_node":"master_host"}
- {"name":"small", "filename":"${batsim_dir}/platforms/small_platform.xml", "master_node":"master_host"}
- {"name":"cluster", "filename":"${batsim_dir}/platforms/cluster512.xml", "master_node":"master_host0"}
nb_dyn_jobs: [0,1,10]
energy:
#- {"name": "enabled", "option":"-E "}
- {"name": "disabled", "option":""}
algo:
- {"name":"submitter", "sched_name":"submitter"}
workload:
- {"name":"one_job", "filename":"${batsim_dir}/workloads/one_delay_job.json"}
mode:
- {"name":"diff_profiles__bundledp", "increase_jobs_duration":"true", "send_profile_if_already_sent":"true", "send_profiles_in_separate_event":"false"}
- {"name":"diff_profiles__separatep", "increase_jobs_duration":"true", "send_profile_if_already_sent":"true", "send_profiles_in_separate_event":"true"}
- {"name":"same_profiles__resend__bundledp", "increase_jobs_duration":"false", "send_profile_if_already_sent":"true", "send_profiles_in_separate_event":"false"}
- {"name":"same_profiles__resend__separatep", "increase_jobs_duration":"false", "send_profile_if_already_sent":"true", "send_profiles_in_separate_event":"true"}
- {"name":"same_profiles__no_resend__bundledp", "increase_jobs_duration":"false", "send_profile_if_already_sent":"false", "send_profiles_in_separate_event":"false"}
- {"name":"same_profiles__no_resend__separatep", "increase_jobs_duration":"false", "send_profile_if_already_sent":"false", "send_profiles_in_separate_event":"true"}
redis_enabled: ["true", "false"]
dynamic_submit_ack: ["true", "false"]
generic_instance:
variables:
socket_port: "$((${instance_number} + 28000))"
timeout: 3600
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${instance_id}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} ${energy[option]} -e ${output_directory}/out --mmax-workload --config-file ${output_directory}/batsim.conf -vdebug -m ${platform[master_node]} -s "tcp://localhost:${socket_port}"
sched_command: ${BATSCHED_BIN:=batsched} -v ${algo[sched_name]} --variant_options_filepath ${output_directory}/sched_input.json -s "tcp://*:${socket_port}"
commands_before_execution:
# Generate Batsim config file
- |
#!/usr/bin/env bash
cat > ${output_directory}/batsim.conf << EOF
{
"redis": {
"enabled": ${redis_enabled}
},
"job_submission": {
"forward_profiles": false,
"from_scheduler":{
"enabled": true,
"acknowledge": ${dynamic_submit_ack}
}
}
}
EOF
# Generate sched input
- |
#!/usr/bin/env bash
source ${output_directory}/variables.bash
cat > ${output_directory}/sched_input.json << EOF
{
"nb_jobs_to_submit": ${nb_dyn_jobs},
"increase_jobs_duration": ${mode[increase_jobs_duration]},
"send_profile_if_already_sent": ${mode[send_profile_if_already_sent]},
"send_profiles_in_separate_event": ${mode[send_profiles_in_separate_event]}
}
EOF
commands_after_execution:
# Checks whether:
# - the number of dynamic jobs is fine
# - the dynamic jobs have correct execution time
- |
#!/usr/bin/env bash
source ${output_directory}/variables.bash
cat > ${output_directory}/jobs_analysis.R <<EOF
#!/usr/bin/env Rscript
library(dplyr)
# Let's get when jobs have been released
jobs = read.csv('${output_directory}/out_jobs.csv')
nb_expected_dynamic_jobs = ${nb_dyn_jobs}
dynamic_jobs = jobs %>% filter(workload_name == 'dynamic')
# Let's check the number of dynamic jobs
if (nrow(dynamic_jobs) != nb_expected_dynamic_jobs) {
stop(sprintf("Expecting %d dynamic jobs but %d have been found", nb_expected_dynamic_jobs, nrow(dynamic_jobs)))
} else {
sprintf("There are %d dynamic jobs (as expected)", nb_expected_dynamic_jobs)
}
# Let's check the dynamic jobs execution times
if(toupper("${mode[increase_jobs_duration]}") == TRUE) {
dynamic_jobs['expected_execution_time'] = dynamic_jobs['job_id'] * 10 + 1
} else {
# Using dynamic_jobs['job_id'] * 0 to conserve a vector of the good length
dynamic_jobs['expected_execution_time'] = dynamic_jobs['job_id'] * 0 + 1
}
ok_runtime = dynamic_jobs %>% filter(execution_time == expected_execution_time)
bad_runtime = dynamic_jobs %>% filter(execution_time != expected_execution_time)
if (nrow(bad_runtime) > 0) {
print("Some jobs do NOT match their expected execution time")
print(bad_runtime %>% select(-requested_number_of_processors,
-success,
-waiting_time,
-stretch,
-allocated_processors,
-submission_time,
-requested_time,
-starting_time,
-finish_time,
-turnaround_time,
-consumed_energy))
stop("Aborting")
} else {
sprintf("All the jobs match their expected execution time")
}
EOF
- chmod +x ${output_directory}/jobs_analysis.R
- ${output_directory}/jobs_analysis.R
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
commands_after_instances:
- |
#!/usr/bin/env bash
source ${base_output_directory}/variables.bash
cat > ${base_output_directory}/instances_analysis.R <<EOF
#!/usr/bin/env Rscript
library(dplyr)
instances = read.csv("/tmp/batsim_tests/dynamic_submit/instances/instances_info.csv")
# Remove garbage
instances = instances %>% select(-platform__master_node, -platform__filename,
-instance_number, -instance_name,
-explicit, -algo__name, -algo__sched_name,
-energy__option)
# Sort
instances = instances %>% arrange(platform__name, nb_dyn_jobs,
dynamic_submit_ack, redis_enabled)
works = instances %>% filter(status == 'done')
crashes = instances %>% filter(status != 'done')
print("WORKS:")
print(works)
print("CRASHES:")
print(crashes)
EOF
- chmod +x ${base_output_directory}/instances_analysis.R
- ${base_output_directory}/instances_analysis.R
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/energy
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"homo128", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml"}
workload :
- {"name":"tiny", "filename":"${batsim_dir}/workloads/test_workload_profile.json"}
- {"name":"medium", "filename":"${batsim_dir}/workloads/batsim_paper_workload_example.json"}
algo:
- {"name":"inertial_shutdown", "sched_name":"energy_bf_monitoring_inertial"}
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${algo[name]}_${workload[name]}_${platform[name]}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -E -e ${output_directory}/out --mmax-workload --config-file ${output_directory}/batsim.conf
sched_command: ${BATSCHED_BIN:=batsched} -v ${algo[sched_name]} --variant_options_filepath ${output_directory}/sched_input.json
commands_before_execution:
# Generate Batsim configuration
- |
#!/usr/bin/env bash
cat > ${output_directory}/batsim.conf << EOF
{
"redis": {
"enabled": false
},
"job_submission": {
"forward_profiles": false
}
}
EOF
# Generate sched options
- |
#!/usr/bin/env bash
# Since bash associative arrays are not exported, the variables.bash
# is sourced here.
source ${output_directory}/variables.bash
# Let's generate an input file for the scheduler
cat > ${output_directory}/sched_input.json << EOF
{
"output_dir":"${output_directory}",
"trace_output_filename":"${output_directory}/out_sched_load_log.csv",
"inertial_alteration":"p1",
"upper_llh_threshold":500,
"monitoring_period":120,
"idle_time_to_sedate":1e18,
"sedate_idle_on_classical_events":false,
"ensured_sleep_time_lower_bound":0,
"ensured_sleep_time_upper_bound":0,
"power_sleep":9.75,
"power_idle":95,
"energy_switch_on":19030,
"power_compute":190.738,
"energy_switch_off":620,
"time_switch_off":6.1,
"pstate_sleep":13,
"pstate_compute":0,
"time_switch_on":152
}
EOF
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/energy_minimal
base_variables:
batsim_dir: ${base_working_directory}
evalys_dir: ${EVALYS_DIR} # Environment variable
implicit_instances:
implicit:
sweep:
platform :
- {"name":"homo128", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml"}
workload :
- {"name":"two_jobs", "filename":"${batsim_dir}/workloads/energy_minimal.json"}
algo:
- {"name":"subpart_sleeper", "sched_name":"energy_bf_subpart_sleeper"}
monitoring_period: [30]
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${instance_id}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -E -e ${output_directory}/out --mmax-workload
sched_command: ${BATSCHED_BIN:=batsched} -v ${algo[sched_name]} --variant_options_filepath ${output_directory}/sched_input.json
commands_before_execution:
# Generate sched options
- |
#!/usr/bin/env bash
# Since bash associative arrays are not exported, the variables.bash
# is sourced here.
source ${output_directory}/variables.bash
# Let's generate an input file for the scheduler
cat > ${output_directory}/sched_input.json << EOF
{
"output_dir": "${output_directory}",
"trace_output_filename": "${output_directory}/out_sched_load_log.csv",
"fraction_of_machines_to_let_awake": 1,
"monitoring_period": ${monitoring_period},
"idle_time_to_sedate": 0,
"sedate_idle_on_classical_events": false,
"ensured_sleep_time_lower_bound": 0,
"ensured_sleep_time_upper_bound": 0,
"power_sleep": 9.75,
"power_idle": 95,
"energy_switch_on": 19030,
"power_compute": 190.738,
"energy_switch_off": 620,
"time_switch_off": 6.1,
"pstate_sleep": 13,
"pstate_compute": 0,
"time_switch_on": 152
}
EOF
commands_after_execution:
# Generate plot with evalys
- |
${evalys_dir}/examples/poquetm/plot_energy_info.py \
--gantt --power \
-e ${output_directory}/out_consumed_energy.csv \
-j ${output_directory}/out_jobs.csv \
-p ${output_directory}/out_pstate_changes.csv \
--off 13 --switchon -1 --switchoff -2 \
--names Example \
-o ${output_directory}/energy_plot.pdf
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/energy_query
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"homo128", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml"}
workload :
- {"name":"tiny", "filename":"${batsim_dir}/workloads/test_workload_profile.json"}
- {"name":"medium", "filename":"${batsim_dir}/workloads/batsim_paper_workload_example.json"}
algo:
- {"name":"watcher", "sched_name":"energy_watcher"}
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${algo[name]}_${workload[name]}_${platform[name]}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -E -e ${output_directory}/out --mmax-workload
sched_command: ${BATSCHED_BIN:=batsched} -v ${algo[sched_name]}
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
# This script should be called from Batsim's root directory
# If needed, the working directory of this script can be specified within this file
#base_working_directory: ~/proj/batsim
# If needed, the output directory of this script can be specified within this file
base_output_directory: /tmp/batsim_tests/energy_small
base_variables:
batsim_dir: ${base_working_directory}
evalys_dir: ${EVALYS_DIR}
do_per_instance_plots: 1
implicit_instances:
################################################################################
inertial:
################################################################################
sweep:
platform :
- {"name":"homo128", "filename":"${batsim_dir}/platforms/energy_platform_homogeneous_no_net_128.xml"}
workload :
- {"name":"energy_small", "filename":"${batsim_dir}/workloads/energy_small.json"}
algo:
- {"name":"inertial_shutdown", "sched_name":"energy_bf_monitoring_inertial"}
llh_bound: [500]
generic_instance:
variables:
instance_name: inertial
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${instance_name}
batsim_command: ${BATSIM_BIN:=batsim} -p ${platform[filename]} -w ${workload[filename]} -E -e ${output_directory}/${instance_name} --mmax-workload