Skip to content

Commit

Permalink
added dependency finder util
Browse files Browse the repository at this point in the history
  • Loading branch information
MDobransky committed Sep 12, 2024
1 parent 0defd47 commit b25a562
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions rialto/runner/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright 2022 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__all__ = ["load_module", "table_exists", "get_partitions", "init_tools", "find_dependency"]

from datetime import date
from importlib import import_module
from typing import List, Tuple
Expand Down Expand Up @@ -72,3 +88,17 @@ def init_tools(spark: SparkSession, pipeline: PipelineConfig) -> Tuple[MetadataM
else:
feature_loader = None
return metadata_manager, feature_loader


def find_dependency(config: PipelineConfig, name: str):
"""
Get dependency from config
:param config: Pipeline configuration
:param name: Dependency name
:return: Dependency object
"""
for dep in config.dependencies:
if dep.name == name:
return dep
return None

0 comments on commit b25a562

Please sign in to comment.