Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some scone bugs #99

Merged
merged 1 commit into from
Aug 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pippin/classifiers/scone.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__(self, name, output_dir, config, dependencies, mode, options, index=
heatmaps_path_obj = output_path_obj / "heatmaps"

self.job_base_name = output_path_obj.parents[1].name + "__" + output_path_obj.name
self.heatmaps_job_base_name = self.job_base_name + "__CREATE_HEATMAPS"

self.batch_replace = self.options.get("BATCH_REPLACE", {})
self.slurm = """{sbatch_header}
Expand Down Expand Up @@ -95,7 +94,7 @@ def make_heatmaps(self, mode):
mkdirs(self.heatmaps_path)

sim_dep = self.get_simulation_dependency()
sim_dirs = sim_dep.output["photometry_dirs"]
sim_dirs = sim_dep.output["photometry_dirs"][self.index] # if multiple realizations, get only the current one with self.index

lcdata_paths = self._get_lcdata_paths(sim_dirs)
metadata_paths = [path.replace("PHOT", "HEAD") for path in lcdata_paths]
Expand All @@ -105,7 +104,6 @@ def make_heatmaps(self, mode):
"REPLACE_LOGFILE": self.heatmaps_log_path,
"REPLACE_WALLTIME": "10:00:00", #TODO: change to scale with # of heatmaps expected
"REPLACE_MEM": "8GB",
"APPEND": ["#SBATCH --ntasks=1", "#SBATCH --cpus-per-task=8"]
}
heatmaps_sbatch_header = self.make_sbatch_header("HEATMAPS_BATCH_FILE", header_dict)
with open(self.heatmaps_sbatch_header_path, "w+") as f:
Expand Down Expand Up @@ -232,7 +230,7 @@ def _write_config_file(self, metadata_paths, lcdata_paths, mode, config_path):
config["trained_model"] = self.options.get("MODEL", False)
config["kcor_file"] = self.options.get("KCOR_FILE", None)
config["mode"] = mode
config["job_base_name"] = self.heatmaps_job_base_name
config["job_base_name"] = self.job_base_name
#FOR DES DATA:
# config["sn_type_id_to_name"] ={0.0: "unknown",
# 5.0: "non",
Expand Down Expand Up @@ -273,7 +271,7 @@ def _check_completion(self, squeue):
self.logger.info(f"Predictions file can be found at {pred_path}")
self.output.update({"model_filename": self.options.get("MODEL", os.path.join(self.output_dir, "trained_model")), "predictions_filename": pred_path})
return Task.FINISHED_SUCCESS
return self.check_for_job(squeue, self.heatmaps_job_base_name) + self.check_for_job(squeue, self.job_base_name)
return self.check_for_job(squeue, self.job_base_name)

def _heatmap_creation_success(self):
if not os.path.exists(self.heatmaps_done_file):
Expand Down