Amit Aharoni
02/10/2024, 1:31 PMScout
02/10/2024, 1:31 PMtag_concurrency_limits
in your job's config to limit the number of ops/assets with a specific tag that can run at a given time. However, this approach limits concurrency rather than rate limiting API calls per time interval. 3. Custom Middleware or Services: You might need to implement custom middleware or services that manage the rate limiting logic. This could involve a service that queues up requests and ensures that they are dispatched at a rate that complies with the API's rate limits. Your ops would interact with this service to perform API calls. 4. Dagster Sensors: Although not a direct solution for rate limiting, you could potentially use sensors to monitor the state of your resources and trigger ops based on the availability to make API calls without exceeding rate limits. 5. External Asset: If the operation takes a long time due to external service rate limits and you don't want to keep a Dagster run going, you could model it as an External Asset. You would submit your request to the external service in an op and use another server to listen for a callback, then report a materialization for the asset when the callback is received. Remember that these approaches may require additional infrastructure, such as a Redis server for distributed rate limiting or a custom service for queuing and dispatching API calls. It's important to choose an approach that aligns with your system's architecture and the specific requirements of the APIs you are interacting with.