Skip to content

Commit

Permalink
minor cleanup in hbwtasks and wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
mafrahm committed Aug 4, 2023
1 parent ce436f2 commit 8ee3a6f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
26 changes: 19 additions & 7 deletions hbw/scripts/hbwtasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ hbw_cutflow(){
done
}

ml_model="test"
ml_model="dense_default"
ml_datasets="ml"

hbw_ml_training(){
law run cf.MLTraining --version $version --workers 10 \
--configs $config \
--ml-model $ml_model \
--workflow htcondor \
--htcondor-gpus 1 \
Expand All @@ -72,10 +73,11 @@ hbw_ml_preparation(){
--skip-datasets "qqHH*,data*" \
--cf.MergeMLEvents-workflow local \
--cf.PrepareMLEvents-pilot True \
--cf.MergeMLEvents-parallel-jobs 4000 \
--cf.MergeMLEvents-retries 1 \
--cf.MergeMLEvents-tasks-per-job 1 \
--cf.MergeMLEvents-job-workers 1 \
--cf.PrepareMLEvents-workflow htcondor \
--cf.PrepareMLEvents-parallel-jobs 4000 \
--cf.PrepareMLEvents-retries 1 \
--cf.PrepareMLEvents-tasks-per-job 1 \
--cf.PrepareMLEvents-job-workers 1 \
$@
done
}
Expand All @@ -101,7 +103,7 @@ hbw_plot_variables(){
$@
}

ml_model="default"
ml_model="dense_default"
ml_output_variables="mlscore.*"
ml_categories="resolved,boosted,incl,ml_ggHH_kl_1_kt_1_sl_hbbhww,ml_tt,ml_st,ml_w_lnu,ml_dy_lep"

Expand Down Expand Up @@ -148,8 +150,18 @@ hbw_control_plots_much(){
hbw_datacards(){
law run cf.CreateDatacards --version $version --workers 50 \
--config $config \
--producers ml_inputs --ml-models $ml_model \
--ml-models $ml_model \
--pilot --workflow htcondor \
--retries 1 \
--cf.MLTraining-htcondor-gpus 1 \
--cf.MLTraining-htcondor-memory 40000 \
--cf.MLTraining-max-runtime 48h \
--cf.MergeMLEvents-workflow local \
--cf.PrepareMLEvents-workflow htcondor \
--cf.PrepareMLEvents-htcondor-gpus 0 \
--cf.PrepareMLEvents-htcondor-memory 4000 \
--cf.PrepareMLEvents-max-runtime 3h \
--cf.PrepareMLEvents-pilot True \
--cf.ReduceEvents-workflow htcondor
$@
}
13 changes: 9 additions & 4 deletions hbw/tasks/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
e.g. default sets of plots or datacards
"""

import law

from columnflow.tasks.framework.mixins import (
CalibratorsMixin, # SelectorStepsMixin, ProducersMixin, MLModelsMixin,
)
from columnflow.tasks.plotting import PlotVariables1D
# from columnflow.tasks.framework.remote import RemoteWorkflow
from columnflow.tasks.framework.remote import RemoteWorkflow

from columnflow.util import dev_sandbox

Expand All @@ -19,9 +21,15 @@ class DefaultPlots(
# ProducersMixin,
# SelectorStepsMixin,
CalibratorsMixin,
law.LocalWorkflow,
RemoteWorkflow,
):
sandbox = dev_sandbox("bash::$CF_BASE/sandboxes/venv_columnar.sh")

def create_branch_map(self):
# create a dummy branch map so that this task could as a job
return {0: None}

def requires(self):
reqs = {}

Expand All @@ -30,7 +38,6 @@ def requires(self):
# control plots with data
reqs[f"control_plots_{channel}"] = PlotVariables1D.req(
self,
config="config_2017",
producers=("features",),
processes=(f"d{channel}ch",),
process_settings=[["scale_signal"]],
Expand All @@ -43,7 +50,6 @@ def requires(self):
# ML input features
reqs[f"ml_inputs_{channel}"] = PlotVariables1D.req(
self,
config="config_2017",
producers=("ml_inputs",),
processes=(f"{channel}ch",),
# process_settings=[["scale_signal"]],
Expand All @@ -57,7 +63,6 @@ def requires(self):
ml_model = "dense_default"
reqs[f"ml_outputs_{channel}"] = PlotVariables1D.req(
self,
config="config_2017",
producers=(f"ml_{ml_model}",),
ml_models=(ml_model,),
processes=(f"{channel}ch",),
Expand Down

0 comments on commit 8ee3a6f

Please sign in to comment.