Skip to content

Commit 1ae23c9

Browse files
committed
add flag for profile
1 parent 98809bf commit 1ae23c9

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/datacustomcode/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def zip(path: str):
9797
9898
Choose based on your workload requirements.""",
9999
)
100-
def deploy(path: str, name: str, version: str, description: str, cpu_size: str, profile: str):
100+
def deploy(
101+
path: str, name: str, version: str, description: str, cpu_size: str, profile: str
102+
):
101103
from datacustomcode.credentials import Credentials
102104
from datacustomcode.deploy import TransformationJobMetadata, deploy_full
103105

@@ -194,7 +196,12 @@ def scan(filename: str, config: str, dry_run: bool, no_requirements: bool):
194196
@click.option("--config-file", default=None)
195197
@click.option("--dependencies", default=[], multiple=True)
196198
@click.option("--profile", default="default")
197-
def run(entrypoint: str, config_file: Union[str, None], dependencies: List[str], profile: str):
199+
def run(
200+
entrypoint: str,
201+
config_file: Union[str, None],
202+
dependencies: List[str],
203+
profile: str,
204+
):
198205
from datacustomcode.run import run_entrypoint
199206

200207
run_entrypoint(entrypoint, config_file, dependencies, profile)

src/datacustomcode/run.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121

2222
def run_entrypoint(
23-
entrypoint: str, config_file: Union[str, None], dependencies: List[str], profile: str
23+
entrypoint: str,
24+
config_file: Union[str, None],
25+
dependencies: List[str],
26+
profile: str,
2427
) -> None:
2528
"""Run the entrypoint script with the given config and dependencies.
2629
@@ -31,11 +34,11 @@ def run_entrypoint(
3134
profile: The profile to use.
3235
"""
3336
if profile != "default":
34-
if config.reader_config and hasattr(config.reader_config, 'options'):
37+
if config.reader_config and hasattr(config.reader_config, "options"):
3538
config.reader_config.options["credentials_profile"] = profile
36-
if config.writer_config and hasattr(config.writer_config, 'options'):
39+
if config.writer_config and hasattr(config.writer_config, "options"):
3740
config.writer_config.options["credentials_profile"] = profile
38-
41+
3942
if config_file:
4043
config.load(config_file)
4144
for dependency in dependencies:

tests/test_run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_run_entrypoint_preserves_config(test_config_file, test_entrypoint_file)
9696
entrypoint=test_entrypoint_file,
9797
config_file=test_config_file,
9898
dependencies=[],
99+
profile="default",
99100
)
100101

101102
# Check that config was maintained
@@ -180,6 +181,7 @@ def test_run_entrypoint_with_dependencies():
180181
entrypoint=entrypoint_file,
181182
config_file=config_file,
182183
dependencies=[module_name],
184+
profile="default",
183185
)
184186

185187
# Verify dependency was imported and used

0 commit comments

Comments
 (0)