Skip to content

Commit

Permalink
fixed library handling
Browse files Browse the repository at this point in the history
  • Loading branch information
stikkireddy committed Aug 10, 2023
1 parent eca5613 commit 14922ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 10 additions & 6 deletions brickflow/cli/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,20 @@ def _apply_bundles_deployment_options(func: Callable) -> Callable[..., Any]:
return _apply_bundles_deployment_options


def handle_libraries(skip_libraries: Optional[bool] = None, **_: Any) -> None:
if skip_libraries is True:
BrickflowProjectDeploymentSettings().brickflow_auto_add_libraries = False
else:
BrickflowProjectDeploymentSettings().brickflow_auto_add_libraries = True


@projects.command(name="destroy")
@apply_bundles_deployment_options
def destroy_project(project: str, **kwargs: Any) -> None:
"""Destroy projects in the brickflow-multi-project.yml file"""
bf_project = multi_project_manager.get_project(project)
dir_to_change = multi_project_manager.get_project_ref(project).root_yaml_rel_path
if kwargs.get("skip_libraries", None) is True:
BrickflowProjectDeploymentSettings().brickflow_auto_add_libraries = False
handle_libraries(**kwargs)
with use_project(project, bf_project, multi_project_manager.root(), dir_to_change):
bundle_destroy(
workflows_dir=bf_project.path_project_root_to_workflows_dir, **kwargs
Expand All @@ -584,8 +590,7 @@ def synth_bundles_for_project(project: str, **kwargs: Any) -> None:
"""Synth the bundle.yml for project"""
bf_project = multi_project_manager.get_project(project)
dir_to_change = multi_project_manager.get_project_ref(project).root_yaml_rel_path
if kwargs.get("skip_libraries", None) is True:
BrickflowProjectDeploymentSettings().brickflow_auto_add_libraries = False
handle_libraries(**kwargs)
with use_project(project, bf_project, multi_project_manager.root(), dir_to_change):
# wf dir is required for generating the bundle.yml in the workflows dir
project_synth(
Expand All @@ -599,8 +604,7 @@ def deploy_project(project: str, **kwargs: Any) -> None:
"""Deploy projects in the brickflow-multi-project.yml file"""
bf_project = multi_project_manager.get_project(project)
dir_to_change = multi_project_manager.get_project_ref(project).root_yaml_rel_path
if kwargs.get("skip_libraries", None) is True:
BrickflowProjectDeploymentSettings().brickflow_auto_add_libraries = False
handle_libraries(**kwargs)
with use_project(project, bf_project, multi_project_manager.root(), dir_to_change):
bundle_deploy(
workflows_dir=bf_project.path_project_root_to_workflows_dir, **kwargs
Expand Down
10 changes: 6 additions & 4 deletions brickflow/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,13 @@ def filter_bf_related_libraries(
resp: List[TaskLibrary] = []
for lib in libraries:
if isinstance(lib, PypiTaskLibrary):
if lib.package.startswith("brickflow") is False:
resp.append(lib)
if lib.package.startswith("brickflow") is True:
continue
if isinstance(lib, MavenTaskLibrary):
if lib.coordinates.startswith("com.cronutils:cron-utils:9.2.0") is False:
resp.append(lib)
# TODO: clean this up but no one should really be using cron-utils at the moment for outside of brickflow
if lib.coordinates.startswith("com.cronutils:cron-utils:9.2.0") is True:
continue
resp.append(lib)
return resp


Expand Down

0 comments on commit 14922ce

Please sign in to comment.