glamorous-butcher-83479
11/20/2024, 11:45 AM--with
flag? for example something like
python flow.py run \
--with batch:gpu=1,memory=16000,step=gpu_step
square-wire-39606
11/21/2024, 10:14 PMglamorous-butcher-83479
11/22/2024, 9:49 AMdef custom_batch(**batch_kwargs):
"""
A wrapper for the @batch decorator that bypasses and runs locally
if the METAFLOW_FORCE_LOCAL environment variable is set to 'true'.
"""
def decorator(func):
if os.getenv("METAFLOW_FORCE_LOCAL", "false").lower() in ["true", "1"]:
# Bypass behavior: Return the original function without @batch
@wraps(func)
def bypassed_func(*args, **kwargs):
print("METAFLOW_FORCE_LOCAL is set. Running locally without @batch.")
return func(*args, **kwargs)
return bypassed_func
else:
print("Running with @batch")
# Normal @batch behavior
return batch(**batch_kwargs)(func)
return decorator