high-scooter-88084
04/12/2023, 12:06 AMfrom metaflow import FlowSpec, step, conda_base, project
def blackbox():
# Function not in core library
import time
time.sleep(10)
# maybe fails sometimes
import random
if random.random() < 0.01:
raise ValueError("Gotcha")
return "SUCCESS"
@project("someproject")
@conda_base(pip=PIP_DEPENDENCIES, python=PYTHON_VERSION)
class SomeFlow(FlowSpec):
@step
def start(self):
self.seeds = range(100)
self.next(self.heavy_step, foreach="seeds")
@conda(libraries=MORE_PIP_DEPENDENCIES)
@step
def heavy_step(self):
seed = self.input
# Do some expensive blackbox step
# You don't want to retry if this fails due to transient error
blackbox()
self.next(self.join)
@step
def join(self, inputs):
self.merge_artifacts(inputs)
self.next(self.end)
@step
def end(self):
print("ended")
if __name__ == "__main__":
SomeFlow()
Is that possible with @retry ? AFAIK it doesn't look like. Would adding a retry in conda_base/conda decorators and passing it all the way to batch_bootstrap fit with the overall design principle of metaflow ? If not, is there a better/easier way to do this ?dry-beach-38304
04/12/2023, 12:10 AM@retry should catch all errors (so the one in blackbox and conda). The retry happens at the very top level (ie: either in the orchestrator or the local runtime). If you want the behavior you describe (retry for conda but not others), you should wrap the code in your step with try: except: . This won’t catch everything and you may still retry in that part (due to OOMs for example) but I think it’s close to what you want. In the except part, you would have to cleanly terminate your step so that your flow can continue.dry-beach-38304
04/12/2023, 12:11 AM@conda decorator that is in metaflow does not support pip dependencies. You can use an experimental extension one that does though.high-scooter-88084
04/12/2023, 12:15 AMdry-beach-38304
04/12/2023, 12:19 AMdry-beach-38304
04/12/2023, 12:19 AMhigh-scooter-88084
04/12/2023, 12:25 AMhigh-scooter-88084
04/12/2023, 12:26 AMdry-beach-38304
04/12/2023, 12:26 AMdry-beach-38304
04/12/2023, 12:26 AMhigh-scooter-88084
04/12/2023, 12:27 AMdry-beach-38304
04/12/2023, 12:28 AMdry-beach-38304
04/12/2023, 12:28 AMhigh-scooter-88084
04/12/2023, 12:28 AMdry-beach-38304
04/12/2023, 12:29 AMdry-beach-38304
04/12/2023, 12:30 AMhigh-scooter-88084
04/12/2023, 12:30 AMdry-beach-38304
04/12/2023, 12:31 AM@retry on the step but an argument to the @conda_base.high-scooter-88084
04/12/2023, 12:31 AMhigh-scooter-88084
04/12/2023, 12:31 AMdry-beach-38304
04/12/2023, 12:31 AMdry-beach-38304
04/12/2023, 12:32 AMdry-beach-38304
04/12/2023, 12:32 AMdry-beach-38304
04/12/2023, 12:33 AMhigh-scooter-88084
04/12/2023, 12:34 AMhigh-scooter-88084
04/12/2023, 12:35 AMdry-beach-38304
04/12/2023, 12:37 AMdry-beach-38304
04/12/2023, 12:37 AMancient-application-36103
04/12/2023, 1:04 AM@conda implementation DDOSing the upstream channel when you launch multiple parallel workloadshigh-scooter-88084
04/12/2023, 1:09 AMancient-application-36103
04/12/2023, 1:11 AM@conda decorator - that way you would also be able to make sure that you are not paying the cost of spinning up yet another AWS Batch job only to retry the environment creation.high-scooter-88084
04/12/2023, 1:12 AMdry-beach-38304
04/12/2023, 1:13 AMdry-beach-38304
04/12/2023, 1:14 AMancient-application-36103
04/12/2023, 1:15 AM