pythontemporal-workflow

How to use return value (str) of one activity as input a second activity in temporal python sdk?


I'm using the python sdk for https://temporal.io/. I have a workflow that i'd like to execute two sequential activities.

  1. Do X and return a filepath.
  2. Do Y with data at that filepath.
@workflow.defn
class ScraperWorkflow:
    @workflow.run
    async def run(self, scraper_input: ScraperInput):
        
        scraper_result = await workflow.execute_activity(
            ercot_scraper, # activity that takes scraper_input and returns a path
            scraper_input,
        )
 
        extractor_result = await workflow.execute_activity(
            extract_activity,
            path_from_previous_activity,
        )
        return 

How do i get path_from_previous_activity from the first activity?!!


Solution

  • What do you mean with "path_from_previous_activity"?

    You can pass the results of your fist activity as input to the second one. so can pass scraper_result as input to your extract_activity.