Slackbot
03/20/2023, 3:27 PMElijah Ben Izzy
03/20/2023, 4:01 PMElijah Ben Izzy
03/20/2023, 4:01 PMget_patterns
in get_filepaths
, instead, you want get_filepaths
to depend on get_patterns
Elijah Ben Izzy
03/20/2023, 4:04 PMdef filepaths(patterns: List[str]) -> List:
"""returns all filepaths that match pattern"""
paths = get_matching_paths(patterns)
return paths
@config.when(data="cost")
def patterns__cost(org: int, provider: str, lookback: int) -> List[str]:
"""Retruns patterns that match for cost data"""
patterns = []
# some patterns logic...
return patterns
@config.when(data="utilisation")
def patterns__util(org: int, provider: str, lookback: int) -> List[str]:
"""Retruns patterns that match for utilisation data"""
patterns = []
# some patterns logic...
return patterns
and load_data
should be something like this:
def data_loaded(spark: SparkSession, filepaths: List[str]):
...
Elijah Ben Izzy
03/20/2023, 4:04 PMElijah Ben Izzy
03/20/2023, 4:05 PMElijah Ben Izzy
03/20/2023, 4:09 PMget_patterns
wasn’t being recognized is cause Hamilton doesn’t actually rename the function — it just sets the name of the nodes it creates. So, the functions were still called get_patterns__util
, and when you called get_patterns
python couldn’t find them 🙂Ankush Kundaliya
03/20/2023, 4:09 PMfilepaths
function I guess.
Thanks Elijah!Elijah Ben Izzy
03/20/2023, 4:10 PMAnkush Kundaliya
03/20/2023, 4:24 PMElijah Ben Izzy
03/20/2023, 4:25 PMAnkush Kundaliya
03/20/2023, 5:07 PMElijah Ben Izzy
03/20/2023, 5:21 PM