Commit 58411713 authored by sparonuz's avatar sparonuz
Browse files

[ReintroducingExceptionManager]: refactored init funcion

parent 569cc9ba
import signal
from AutoRPE.UtilsWorkflow.Communicator import SSH
class GracefulKiller:
......@@ -21,38 +22,14 @@ class GracefulKiller:
class PrecisionAnalysis:
"""
The precision analysis class has the purpose of
"""
def __init__(self,
# Few parameters needed to start a remote connection
remote_hostname=None,
remote_user=None,
remote_scratch=None,
max_running_jobs=10,
local_folder=None,
# Few experiment details
job_template=None,
reduced_precision_level=10,
def __init__(self, remote_hostname, remote_user, remote_scratch,
local_folder, job_template, vault,
reduced_precision_level, analysis_variables, accuracy_test, max_running_jobs,
experiment_name="PrecisionAnalysis",
forced_variables=None, checkpoint_name=None):
# Few arguments that are required
vault=None,
accuracy_test=None,
analysis_variables=None,
forced_variables=None,
# In case of starting from a checkpoint
checkpoint_name=None,
):
from AutoRPE.UtilsWorkflow.Communicator import SSH
# Saving all the arguments as elements of the class
# Remote connection related parameters
self.experiment_name = experiment_name
# Remote connection related parameters
self.remote_hostname = remote_hostname
self.remote_user = remote_user
self.remote_scratch = remote_scratch
......@@ -64,7 +41,7 @@ class PrecisionAnalysis:
# Parameters of the analysis
self.reduced_precision_level = reduced_precision_level
# Experiment specific related stuff
# Experiment related parameter
self.accuracy_test = accuracy_test
self.job_template = job_template
self.vault = vault
......@@ -88,10 +65,10 @@ class PrecisionAnalysis:
from AutoRPE.UtilsWorkflow.Driver import ExperimentDriver
from AutoRPE.UtilsWorkflow.CheckpointTools import recover_checkpoint
vault = self.vault
# Keeping the variables that have an id (it's precision can be changed in the code)
variables = [v for v in vault.variables if v.id is not None]
variables = [v for v in self.vault.variables if v.id is not None]
# ??? This does not make any sense, variables will always coincide with self.analysis_var
if self.analysis_variables:
variables = [v for v in variables if v.id in self.analysis_variables]
......@@ -106,7 +83,7 @@ class PrecisionAnalysis:
forced_variables=self.forced_variables,
reduced_precision_level=self.reduced_precision_level,
communicator=self.communicator,
vault=vault,
vault=self.vault,
template=self.job_template,
accuracy_test=self.accuracy_test,
local_folder=self.local_folder)
......@@ -117,13 +94,13 @@ class PrecisionAnalysis:
else:
# Loading from checkpoint
print("Resuming from %s" % self.checkpoint_name)
experiment, starting_job, loops = recover_checkpoint(communicator=self.communicator, vault=vault,
experiment, starting_job, loops = recover_checkpoint(communicator=self.communicator, vault=self.vault,
filename=self.checkpoint_name)
# As the checkpoint can come from a different local platform, need to adjust template and local folder.
for job in experiment.all():
job.template = self.job_template
job.local_folder = self.local_folder
starting_job.vault = vault
starting_job.vault = self.vault
# Save the experiment driver in the class object
self.experiment_driver = experiment
......@@ -156,7 +133,6 @@ class PrecisionAnalysis:
def run(self):
###############################################
from AutoRPE.UtilsRPE.SourceManager import store_variable_list
from AutoRPE.EvaluationScripts.result_explorer import create_explorer
from AutoRPE.UtilsWorkflow.CheckpointTools import checkpoint
import time
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment