Skip to content

Commit

Permalink
Merge pull request #730 from spotify/erikbern/core
Browse files Browse the repository at this point in the history
changed EnvironmentParamsContainer -> core
  • Loading branch information
Erik Bernhardsson committed Feb 10, 2015
2 parents a9605c4 + 12bbc32 commit f577612
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions luigi/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setup_interface_logging(conf_file=None):
setup_interface_logging.has_run = True


class EnvironmentParamsContainer(task.ConfigWithoutSection):
class core(task.ConfigWithoutSection):

''' Keeps track of a bunch of environment params.
Expand Down Expand Up @@ -90,8 +90,7 @@ class EnvironmentParamsContainer(task.ConfigWithoutSection):
description='Maximum number of parallel tasks to run')
logging_conf_file = parameter.Parameter(
default=None,
description='Configuration file for logging',
config_path=dict(section='core', name='logging_conf_file'))
description='Configuration file for logging')
module = parameter.Parameter(
default=None,
description='Used for dynamic loading of modules') # see DynamicArgParseInterface
Expand Down Expand Up @@ -132,7 +131,7 @@ def run(tasks, worker_scheduler_factory=None, override_defaults=None):

if worker_scheduler_factory is None:
worker_scheduler_factory = WorkerSchedulerFactory()
env_params = EnvironmentParamsContainer(**override_defaults)
env_params = core(**override_defaults)
# search for logging configuration path first on the command line, then
# in the application config file
logging_conf = env_params.logging_conf_file
Expand Down
2 changes: 1 addition & 1 deletion test/cmdline_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_setup_interface_logging(self, handler, logger):
@mock.patch("warnings.warn")
@mock.patch("luigi.interface.setup_interface_logging")
def test_cmdline_logger(self, setup_mock, warn):
with mock.patch("luigi.interface.EnvironmentParamsContainer") as env_params:
with mock.patch("luigi.interface.core") as env_params:
env_params.return_value.logging_conf_file = None
luigi.run(['SomeTask', '--n', '7', '--local-scheduler', '--no-lock'])
self.assertEqual([mock.call(None)], setup_mock.call_args_list)
Expand Down
2 changes: 1 addition & 1 deletion test/interface_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import luigi
import luigi.date_interval
import luigi.notifications
from luigi.interface import EnvironmentParamsContainer, Interface, WorkerSchedulerFactory
from luigi.interface import core, Interface, WorkerSchedulerFactory
from luigi.worker import Worker
from mock import Mock

Expand Down
4 changes: 2 additions & 2 deletions test/parameter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,12 @@ class A(luigi.Task):
class OverrideEnvStuff(unittest.TestCase):

def setUp(self):
env_params_cls = luigi.interface.EnvironmentParamsContainer
env_params_cls = luigi.interface.core
env_params_cls.scheduler_port.reset_global()

@with_config({"core": {"default-scheduler-port": '6543'}})
def testOverrideSchedulerPort(self):
env_params = luigi.interface.EnvironmentParamsContainer()
env_params = luigi.interface.core()
self.assertEqual(env_params.scheduler_port, 6543)


Expand Down

0 comments on commit f577612

Please sign in to comment.