Skip to content

Commit

Permalink
merge logger name change
Browse files Browse the repository at this point in the history
  • Loading branch information
arunjose696 committed Mar 7, 2023
2 parents 3d093cb + 186e090 commit 7045e94
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
10 changes: 4 additions & 6 deletions unidist/core/backends/mpi/core/async_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import unidist.core.backends.mpi.core.common as common
import unidist.core.backends.mpi.core.communication as communication

mpi_state = communication.MPIState.get_instance()
# Logger configuration
# When building documentation we do not have MPI initialized so
# we use the condition to set "worker_0.log" in order to build it succesfully.
log_file = "worker_{}.log".format(
communication.MPIState.get_instance().rank
if communication.MPIState.get_instance() is not None
else 0
)
logger = common.get_logger("worker", log_file)
logger_name = "worker_{}".format(mpi_state.rank if mpi_state is not None else 0)
log_file = "{}.log".format(logger_name)
logger = common.get_logger(logger_name, log_file)


class AsyncOperations:
Expand Down
6 changes: 3 additions & 3 deletions unidist/core/backends/mpi/core/worker/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
# Logger configuration
# When building documentation we do not have MPI initialized so
# we use the condition to set "worker_0.log" in order to build it succesfully.
log_file = "worker_{}.log".format(mpi_state.rank if mpi_state is not None else 0)
w_logger = common.get_logger("worker", sys.stdout, True)

logger_name = "worker_{}".format(mpi_state.rank if mpi_state is not None else 0)
log_file = "{}.log".format(logger_name)
w_logger = common.get_logger(logger_name, log_file)
# Actors map {handle : actor}
actor_map = {}

Expand Down
10 changes: 4 additions & 6 deletions unidist/core/backends/mpi/core/worker/object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import unidist.core.backends.mpi.core.communication as communication


mpi_state = communication.MPIState.get_instance()
# Logger configuration
# When building documentation we do not have MPI initialized so
# we use the condition to set "worker_0.log" in order to build it succesfully.
log_file = "worker_{}.log".format(
communication.MPIState.get_instance().rank
if communication.MPIState.get_instance() is not None
else 0
)
logger = common.get_logger("worker", log_file)
logger_name = "worker_{}".format(mpi_state.rank if mpi_state is not None else 0)
log_file = "{}.log".format(logger_name)
logger = common.get_logger(logger_name, log_file)


class ObjectStore:
Expand Down
5 changes: 3 additions & 2 deletions unidist/core/backends/mpi/core/worker/request_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
# Logger configuration
# When building documentation we do not have MPI initialized so
# we use the condition to set "worker_0.log" in order to build it succesfully.
log_file = "worker_{}.log".format(mpi_state.rank if mpi_state is not None else 0)
logger = common.get_logger("worker", log_file)
logger_name = "worker_{}".format(mpi_state.rank if mpi_state is not None else 0)
log_file = "{}.log".format(logger_name)
logger = common.get_logger(logger_name, log_file)


class RequestStore:
Expand Down
11 changes: 4 additions & 7 deletions unidist/core/backends/mpi/core/worker/task_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
from unidist.core.backends.mpi.core.worker.object_store import ObjectStore
from unidist.core.backends.mpi.core.worker.request_store import RequestStore


mpi_state = communication.MPIState.get_instance()
# Logger configuration
# When building documentation we do not have MPI initialized so
# we use the condition to set "worker_0.log" in order to build it succesfully.
log_file = "worker_{}.log".format(
communication.MPIState.get_instance().rank
if communication.MPIState.get_instance()
else 0
)
w_logger = common.get_logger("worker", log_file)
logger_name = "worker_{}".format(mpi_state.rank if mpi_state is not None else 0)
log_file = "{}.log".format(logger_name)
w_logger = common.get_logger(logger_name, log_file)


class TaskStore:
Expand Down

0 comments on commit 7045e94

Please sign in to comment.