CarbonAware Prefect API
CarbonAware Delay Decorator
Decorator to delay execution until a CO2-optimal time.
If region and provider are not specified, and they can't be detected automatically, a warning will be logged and no delay will be applied.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                window
             | 
            
                  timedelta
             | 
            
               The maximum delay to wait for an optimal time.  | 
            
                  timedelta(hours=6)
             | 
          
                duration
             | 
            
                  timedelta
             | 
            
               The duration of the job.  | 
            
                  timedelta(minutes=30)
             | 
          
                region
             | 
            
                  str | None
             | 
            
               The region of the cloud zone. If not specified, it will be detected automatically.  | 
            
                  None
             | 
          
                provider
             | 
            
                  str | None
             | 
            
               The provider of the cloud zone. If not specified, it will be detected automatically.  | 
            
                  None
             | 
          
Returns:
| Type | Description | 
|---|---|
| 
               A decorator function that can be applied to any function to delay its execution.  | 
          
Source code in .venv/lib/python3.13/site-packages/carbonaware_prefect/decorator.py
              CarbonAware Delay Task
Creates a Prefect task that delays execution until a CO2-optimal time.
If region and provider are not specified, and they can't be detected automatically, a warning will be logged and no delay will be applied.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                window
             | 
            
                  timedelta
             | 
            
               The maximum delay to wait for an optimal time.  | 
            
                  timedelta(hours=6)
             | 
          
                duration
             | 
            
                  timedelta
             | 
            
               The duration of the job.  | 
            
                  timedelta(minutes=30)
             | 
          
                region
             | 
            
                  str | None
             | 
            
               The region of the cloud zone. If not specified, it will be detected automatically.  | 
            
                  None
             | 
          
                provider
             | 
            
                  str | None
             | 
            
               The provider of the cloud zone. If not specified, it will be detected automatically.  | 
            
                  None
             | 
          
                **task_kwargs
             | 
            
               Additional keyword arguments to pass to the Prefect task.  | 
            
                  {}
             | 
          
Returns:
| Type | Description | 
|---|---|
| 
               A Prefect task that delays execution until a CO2-optimal time.  |