Skip to content

Commit

Permalink
Update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosfelt committed Mar 19, 2022
1 parent 1247e31 commit e19f0f9
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions multitask/kinetic_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@
app = typer.Typer()
N_RETRIES = 5

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

# create a file handler
handler = logging.FileHandler("data/kinetic_models/kinetic_optimization.log")
handler.setLevel(logging.INFO)

# create a logging format
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
handler.setFormatter(formatter)

# add the file handler to the logger
logger.addHandler(handler)


@app.command()
def stbo(
Expand Down Expand Up @@ -73,6 +59,7 @@ def stbo(
return
args = dict(locals())
args["strategy"] = "STBO"
logger = logging.getLogger(__name__)

# Ouptut path
output_path = Path(output_path)
Expand Down Expand Up @@ -145,6 +132,7 @@ def stbo_tune(
):
from ray import tune

logger = logging.getLogger(__name__)
output_path = Path(output_path)

def trainable(config):
Expand Down Expand Up @@ -211,7 +199,8 @@ def mtbo(
return
args = dict(locals())
args["strategy"] = "MTBO"
print("Torch number of threads: ", torch.get_num_threads())
logger = logging.getLogger(__name__)
logger.debug(f"Torch number of threads: {torch.get_num_threads()}")

# Load benchmark
# exp = get_mit_case(case=case, noise_level=noise_level)
Expand Down Expand Up @@ -314,6 +303,7 @@ def mtbo_tune(
import ray

output_path = Path(output_path)
logger = logging.getLogger(__name__)

def trainable(config):
import torch
Expand Down Expand Up @@ -597,4 +587,20 @@ def run(self, **kwargs):


if __name__ == "__main__":
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

# create a file handler
handler = logging.FileHandler("data/kinetic_models/kinetic_optimization.log")
handler.setLevel(logging.INFO)

# create a logging format
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
handler.setFormatter(formatter)

# add the file handler to the logger
logger.addHandler(handler)

app()

0 comments on commit e19f0f9

Please sign in to comment.