airflow-client-python icon indicating copy to clipboard operation
airflow-client-python copied to clipboard

get_dags does not fetch more than 100 dags.

Open hhmahmood opened this issue 3 years ago • 4 comments

Hi,

The function does not return more than 100 dags even setting the limit to more than 100. So get_dags(limit=500) will only return max of 100 dags.

I have to do the hack to mitigate this problem.

    def _get_dags(self, max_dags: int = 500):
        i = 0
        responses = []
        while i <= max_dags:
            response = self._api.get_dags(offset=i)
            responses += response['dags']
            i = i + 100
        return [dag['dag_id'] for dag in responses]

Versions I am using are:

apache-airflow==2.3.2
apache-airflow-client==2.3.0

and

apache-airflow==2.2.2
apache-airflow-client==2.1.0

Best, Hamid

hhmahmood avatar Sep 16 '22 22:09 hhmahmood