Skip to content

Commit

Permalink
remove weird single_threaded arg
Browse files Browse the repository at this point in the history
  • Loading branch information
iknox-fa committed Nov 29, 2022
1 parent 9949d99 commit 448e401
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 17 deletions.
4 changes: 1 addition & 3 deletions core/dbt/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
class RuntimeArgs:
project_dir: str
profiles_dir: str
single_threaded: bool
profile: str
target: str

Expand Down Expand Up @@ -61,7 +60,7 @@ def compile_and_execute(self, manifest, ctx):
return result


def get_dbt_config(project_dir, args=None, single_threaded=False):
def get_dbt_config(project_dir, args=None):
from dbt.config.runtime import RuntimeConfig
import dbt.adapters.factory
import dbt.events.functions
Expand All @@ -74,7 +73,6 @@ def get_dbt_config(project_dir, args=None, single_threaded=False):
runtime_args = RuntimeArgs(
project_dir=project_dir,
profiles_dir=profiles_dir,
single_threaded=single_threaded,
profile=getattr(args, "profile", None),
target=getattr(args, "target", None),
)
Expand Down
1 change: 0 additions & 1 deletion core/dbt/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class BaseTask(metaclass=ABCMeta):

def __init__(self, args, config):
self.args = args
self.args.single_threaded = False
self.config = config

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/task/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _submit(self, pool, args, callback):
This does still go through the callback path for result collection.
"""
if self.config.args.single_threaded:
if self.config.args.threads == 1:
callback(self.call_runner(*args))
else:
pool.apply_async(self.call_runner, args=args, callback=callback)
Expand Down
8 changes: 1 addition & 7 deletions core/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,17 +521,12 @@ def connection_named(self, adapter, name):
yield


class ThreadedArgs(Protocol):
single_threaded: bool


class HasThreadingConfig(Protocol):
args: ThreadedArgs
threads: Optional[int]


def executor(config: HasThreadingConfig) -> ConnectingExecutor:
if config.args.single_threaded:
if config.threads == 1:
return SingleThreadedExecutor()
else:
return MultiThreadedExecutor(max_workers=config.threads)
Expand Down Expand Up @@ -652,7 +647,6 @@ def args_to_dict(args):
"full_refresh",
"fail_fast",
"warn_error",
"single_threaded",
"log_cache_events",
"store_failures",
"use_experimental_parser",
Expand Down
4 changes: 0 additions & 4 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def __eq__(self, other):
class TestArgs:
def __init__(self, kwargs):
self.which = 'run'
self.single_threaded = False
self.profiles_dir = None
self.project_dir = None
self.__dict__.update(kwargs)
Expand Down Expand Up @@ -540,9 +539,6 @@ def run_dbt_and_check(self, args=None, profiles_dir=True):

final_args = []

if os.getenv('DBT_TEST_SINGLE_THREADED') in ('y', 'Y', '1'):
final_args.append('--single-threaded')

final_args.extend(args)

if profiles_dir:
Expand Down
1 change: 0 additions & 1 deletion test/unit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def normalize(path):

class Obj:
which = 'blah'
single_threaded = False


def mock_connection(name, state='open'):
Expand Down

0 comments on commit 448e401

Please sign in to comment.