Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/airflow/sdk/bases/timetable.py: 83%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1# Licensed to the Apache Software Foundation (ASF) under one 

2# or more contributor license agreements. See the NOTICE file 

3# distributed with this work for additional information 

4# regarding copyright ownership. The ASF licenses this file 

5# to you under the Apache License, Version 2.0 (the 

6# "License"); you may not use this file except in compliance 

7# with the License. You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, 

12# software distributed under the License is distributed on an 

13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

14# KIND, either express or implied. See the License for the 

15# specific language governing permissions and limitations 

16# under the License. 

17 

18from __future__ import annotations 

19 

20from typing import TYPE_CHECKING 

21 

22if TYPE_CHECKING: 

23 from airflow.sdk.definitions.asset import BaseAsset 

24 

25 

26class BaseTimetable: 

27 """Base class inherited by all user-facing timetables.""" 

28 

29 can_be_scheduled: bool = True 

30 """ 

31 Whether this timetable can actually schedule runs in an automated manner. 

32 

33 This defaults to and should generally be *True* (including non periodic 

34 execution types like *@once* and data triggered tables), but 

35 ``NullTimetable`` sets this to *False*. 

36 """ 

37 

38 active_runs_limit: int | None = None 

39 """ 

40 Maximum active runs that can be active at one time for a DAG. 

41 

42 This is called during DAG initialization, and the return value is used as 

43 the DAG's default ``max_active_runs`` if not set on the DAG explicitly. This 

44 should generally return *None* (no limit), but some timetables may limit 

45 parallelism, such as ``ContinuousTimetable``. 

46 """ 

47 

48 asset_condition: BaseAsset | None = None 

49 

50 def validate(self) -> None: 

51 """ 

52 Validate the timetable is correctly specified. 

53 

54 Override this method to provide run-time validation raised when a DAG 

55 is put into a dagbag. The default implementation does nothing. 

56 

57 :raises: :class:`~airflow.sdk.exceptions.AirflowTimetableInvalid` on validation failure. 

58 """