Skip to content

Commit

Permalink
Revert "Add override_logging argument to Worker (#634) (#636)"
Browse files Browse the repository at this point in the history
This reverts commit 1afa214.
  • Loading branch information
wbarnha committed Aug 23, 2024
1 parent a50e525 commit d851928
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 49 deletions.
15 changes: 0 additions & 15 deletions docs/includes/settingref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2135,21 +2135,6 @@ Level used when redirecting standard outputs.
The logging level to use when redirect STDOUT/STDERR to logging.


.. setting:: worker_override_logging

``worker_override_logging``
---------------------------

:type: :class:`bool`
:default: :const:`True`
:environment: :envvar:`WORKER_OVERRIDE_LOGGING`

Override worker logging.

Enable to configure root logger.

Enabled by default.


.. _settings-extending:

Expand Down
2 changes: 0 additions & 2 deletions faust/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ class Command(abc.ABC): # noqa: B024
daemon: bool = False
redirect_stdouts: Optional[bool] = None
redirect_stdouts_level: Optional[int] = None
override_logging: Optional[bool] = None

builtin_options: OptionSequence = builtin_options
options: Optional[OptionList] = None
Expand Down Expand Up @@ -661,7 +660,6 @@ def worker_for_service(
console_port=self.console_port,
redirect_stdouts=self.redirect_stdouts or False,
redirect_stdouts_level=self.redirect_stdouts_level,
override_logging=self.override_logging or False,
loop=loop or asyncio.get_event_loop_policy().get_event_loop(),
daemon=self.daemon,
)
Expand Down
14 changes: 0 additions & 14 deletions faust/types/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def __init__(
# Worker settings:
worker_redirect_stdouts: Optional[bool] = None,
worker_redirect_stdouts_level: Severity = None,
worker_override_logging: Optional[bool] = None,
# Extension settings:
Agent: SymbolArg[Type[AgentT]] = None,
ConsumerScheduler: SymbolArg[Type[SchedulingStrategyT]] = None,
Expand Down Expand Up @@ -2024,19 +2023,6 @@ def worker_redirect_stdouts_level(self) -> Severity:
The logging level to use when redirect STDOUT/STDERR to logging.
"""

@sections.Worker.setting(
params.Bool,
env_name="WORKER_OVERRIDE_LOGGING",
default=True,
)
def worker_override_logging(self) -> bool:
"""Override worker logging.
Enable to configure root logger.
Enabled by default.
"""

@sections.Extension.setting(
params.Symbol(Type[AgentT]),
default="faust:Agent",
Expand Down
4 changes: 0 additions & 4 deletions faust/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def __init__(
loop: Optional[asyncio.AbstractEventLoop] = None,
redirect_stdouts: Optional[bool] = None,
redirect_stdouts_level: Optional[Severity] = None,
override_logging: Optional[bool] = None,
logging_config: Optional[Dict] = None,
**kwargs: Any,
) -> None:
Expand All @@ -241,8 +240,6 @@ def __init__(
redirect_stdouts = conf.worker_redirect_stdouts
if redirect_stdouts_level is None:
redirect_stdouts_level = conf.worker_redirect_stdouts_level or logging.INFO
if override_logging is None:
override_logging = conf.worker_override_logging
if logging_config is None and app.conf.logging_config:
logging_config = dict(app.conf.logging_config)
super().__init__(
Expand All @@ -258,7 +255,6 @@ def __init__(
console_port=console_port,
redirect_stdouts=redirect_stdouts,
redirect_stdouts_level=redirect_stdouts_level,
override_logging=override_logging,
logging_config=logging_config,
loop=loop,
**kwargs,
Expand Down
9 changes: 0 additions & 9 deletions tests/functional/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,6 @@ def test_env_with_prefix(self):
setting=Settings.worker_redirect_stdouts_level,
expected_value="error",
),
EnvCase(
env={"WORKER_OVERRIDE_LOGGING": "no"},
setting=Settings.worker_override_logging,
expected_value=False,
),
],
)
def test_env(self, env, setting, expected_value):
Expand Down Expand Up @@ -560,7 +555,6 @@ def test_defaults(self):
assert conf.web_cors_options is None
assert conf.worker_redirect_stdouts
assert conf.worker_redirect_stdouts_level == "WARN"
assert conf.worker_override_logging

assert conf.agent_supervisor is mode.OneForOneSupervisor

Expand Down Expand Up @@ -683,7 +677,6 @@ def assert_config_equivalent(
},
worker_redirect_stdouts=False,
worker_redirect_stdouts_level="DEBUG",
worker_override_logging=False,
broker_max_poll_records=1000,
broker_max_poll_interval=10000,
timezone=pytz.timezone("US/Eastern"), # noqa: B008
Expand Down Expand Up @@ -752,7 +745,6 @@ def assert_config_equivalent(
web_cors_options=web_cors_options,
worker_redirect_stdouts=worker_redirect_stdouts,
worker_redirect_stdouts_level=worker_redirect_stdouts_level,
worker_override_logging=worker_override_logging,
logging_config=logging_config,
consumer_auto_offset_reset=consumer_auto_offset_reset,
ConsumerScheduler=ConsumerScheduler,
Expand Down Expand Up @@ -817,7 +809,6 @@ def assert_config_equivalent(
assert conf.web_cors_options == web_cors_options
assert conf.worker_redirect_stdouts == worker_redirect_stdouts
assert conf.worker_redirect_stdouts_level == worker_redirect_stdouts_level
assert conf.worker_override_logging == worker_override_logging
assert conf.broker_max_poll_records == broker_max_poll_records
assert conf.broker_max_poll_interval == broker_max_poll_interval
assert conf.logging_config == logging_config
Expand Down
1 change: 0 additions & 1 deletion tests/unit/cli/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def test_worker_for_service(self, *, command):
console_port=command.console_port,
redirect_stdouts=command.redirect_stdouts or False,
redirect_stdouts_level=command.redirect_stdouts_level,
override_logging=command.override_logging or False,
loop=loop,
daemon=command.daemon,
)
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ def test_constructor(self, app):
assert not w2.redirect_stdouts
w3 = Worker(app, redirect_stdouts_level="DEBUG")
assert w3.redirect_stdouts_level == 10
w4 = Worker(app, override_logging=False)
assert not w4.override_logging
w5 = Worker(app, logging_config={"foo": 1})
assert w5.logging_config == {"foo": 1}
w4 = Worker(app, logging_config={"foo": 1})
assert w4.logging_config == {"foo": 1}

def test_set_sensors(self, app):
assert Worker(app, sensors=[1, 2]).sensors == {1, 2}
Expand Down

0 comments on commit d851928

Please sign in to comment.