Skip to content

Commit 6ca5bb0

Browse files
committed
adding clearTaskInstances endpoint
1 parent 405cea6 commit 6ca5bb0

17 files changed

+927
-5
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Apache Airflow management API.
44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project based on [the specs](https://github.com/zachliu/airflow-openapi-specs):
55

66
- API version: 1.0.0
7-
- Package version: 0.0.5
7+
- Package version: 0.1.5
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://github.com/zachliu](https://github.com/zachliu)
1010

@@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
9898
*ConnectionApi* | [**get_connection**](docs/ConnectionApi.md#get_connection) | **GET** /connections/{connection_id} | Get a connection entry
9999
*ConnectionApi* | [**get_connections**](docs/ConnectionApi.md#get_connections) | **GET** /connections | Get all connection entries
100100
*ConnectionApi* | [**patch_connection**](docs/ConnectionApi.md#patch_connection) | **PATCH** /connections/{connection_id} | Update a connection entry
101+
*DAGApi* | [**clear_task_instances**](docs/DAGApi.md#clear_task_instances) | **POST** /dags/{dag_id}/clearTaskInstances | Clear a set of task instances
101102
*DAGApi* | [**get_dag**](docs/DAGApi.md#get_dag) | **GET** /dags/{dag_id} | Get basic information about a DAG
102103
*DAGApi* | [**get_dag_source**](docs/DAGApi.md#get_dag_source) | **GET** /dagSources/{file_token} | Get source code using file token
103104
*DAGApi* | [**get_dag_structure**](docs/DAGApi.md#get_dag_structure) | **GET** /dags/{dag_id}/structure | Get simplified representation of DAG.
@@ -144,6 +145,7 @@ Class | Method | HTTP request | Description
144145
## Documentation For Models
145146

146147
- [ClassReference](docs/ClassReference.md)
148+
- [ClearTaskInstance](docs/ClearTaskInstance.md)
147149
- [CollectionInfo](docs/CollectionInfo.md)
148150
- [Color](docs/Color.md)
149151
- [Config](docs/Config.md)
@@ -183,6 +185,8 @@ Class | Method | HTTP request | Description
183185
- [TaskFail](docs/TaskFail.md)
184186
- [TaskInstance](docs/TaskInstance.md)
185187
- [TaskInstanceCollection](docs/TaskInstanceCollection.md)
188+
- [TaskInstanceReference](docs/TaskInstanceReference.md)
189+
- [TaskInstanceReferenceCollection](docs/TaskInstanceReferenceCollection.md)
186190
- [TaskState](docs/TaskState.md)
187191
- [TimeDelta](docs/TimeDelta.md)
188192
- [TriggerRule](docs/TriggerRule.md)

airflow_python_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212

1313

14-
__version__ = "0.0.5"
14+
__version__ = "0.1.5"
1515

1616
# import ApiClient
1717
from airflow_python_sdk.api_client import ApiClient

airflow_python_sdk/api/dag_api.py

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
none_type,
2323
validate_and_convert_types
2424
)
25+
from airflow_python_sdk.model.clear_task_instance import ClearTaskInstance
2526
from airflow_python_sdk.model.dag import DAG
2627
from airflow_python_sdk.model.dag_collection import DAGCollection
2728
from airflow_python_sdk.model.dag_structure import DagStructure
2829
from airflow_python_sdk.model.error import Error
2930
from airflow_python_sdk.model.inline_response2001 import InlineResponse2001
3031
from airflow_python_sdk.model.task import Task
3132
from airflow_python_sdk.model.task_collection import TaskCollection
33+
from airflow_python_sdk.model.task_instance_reference_collection import TaskInstanceReferenceCollection
3234

3335

3436
class DAGApi(object):
@@ -43,6 +45,136 @@ def __init__(self, api_client=None):
4345
api_client = ApiClient()
4446
self.api_client = api_client
4547

48+
def __clear_task_instances(
49+
self,
50+
dag_id,
51+
clear_task_instance,
52+
**kwargs
53+
):
54+
"""Clear a set of task instances # noqa: E501
55+
56+
Clears a set of task instances associated with the DAG for a specified date range. # noqa: E501
57+
This method makes a synchronous HTTP request by default. To make an
58+
asynchronous HTTP request, please pass async_req=True
59+
60+
>>> thread = api.clear_task_instances(dag_id, clear_task_instance, async_req=True)
61+
>>> result = thread.get()
62+
63+
Args:
64+
dag_id (int): The DAG ID.
65+
clear_task_instance (ClearTaskInstance): Parameters of action
66+
67+
Keyword Args:
68+
_return_http_data_only (bool): response data without head status
69+
code and headers. Default is True.
70+
_preload_content (bool): if False, the urllib3.HTTPResponse object
71+
will be returned without reading/decoding response data.
72+
Default is True.
73+
_request_timeout (float/tuple): timeout setting for this request. If one
74+
number provided, it will be total request timeout. It can also
75+
be a pair (tuple) of (connection, read) timeouts.
76+
Default is None.
77+
_check_input_type (bool): specifies if type checking
78+
should be done one the data sent to the server.
79+
Default is True.
80+
_check_return_type (bool): specifies if type checking
81+
should be done one the data received from the server.
82+
Default is True.
83+
_host_index (int/None): specifies the index of the server
84+
that we want to use.
85+
Default is read from the configuration.
86+
async_req (bool): execute request asynchronously
87+
88+
Returns:
89+
TaskInstanceReferenceCollection
90+
If the method is called asynchronously, returns the request
91+
thread.
92+
"""
93+
kwargs['async_req'] = kwargs.get(
94+
'async_req', False
95+
)
96+
kwargs['_return_http_data_only'] = kwargs.get(
97+
'_return_http_data_only', True
98+
)
99+
kwargs['_preload_content'] = kwargs.get(
100+
'_preload_content', True
101+
)
102+
kwargs['_request_timeout'] = kwargs.get(
103+
'_request_timeout', None
104+
)
105+
kwargs['_check_input_type'] = kwargs.get(
106+
'_check_input_type', True
107+
)
108+
kwargs['_check_return_type'] = kwargs.get(
109+
'_check_return_type', True
110+
)
111+
kwargs['_host_index'] = kwargs.get('_host_index')
112+
kwargs['dag_id'] = \
113+
dag_id
114+
kwargs['clear_task_instance'] = \
115+
clear_task_instance
116+
return self.call_with_http_info(**kwargs)
117+
118+
self.clear_task_instances = Endpoint(
119+
settings={
120+
'response_type': (TaskInstanceReferenceCollection,),
121+
'auth': [
122+
'basicAuth'
123+
],
124+
'endpoint_path': '/dags/{dag_id}/clearTaskInstances',
125+
'operation_id': 'clear_task_instances',
126+
'http_method': 'POST',
127+
'servers': None,
128+
},
129+
params_map={
130+
'all': [
131+
'dag_id',
132+
'clear_task_instance',
133+
],
134+
'required': [
135+
'dag_id',
136+
'clear_task_instance',
137+
],
138+
'nullable': [
139+
],
140+
'enum': [
141+
],
142+
'validation': [
143+
]
144+
},
145+
root_map={
146+
'validations': {
147+
},
148+
'allowed_values': {
149+
},
150+
'openapi_types': {
151+
'dag_id':
152+
(int,),
153+
'clear_task_instance':
154+
(ClearTaskInstance,),
155+
},
156+
'attribute_map': {
157+
'dag_id': 'dag_id',
158+
},
159+
'location_map': {
160+
'dag_id': 'path',
161+
'clear_task_instance': 'body',
162+
},
163+
'collection_format_map': {
164+
}
165+
},
166+
headers_map={
167+
'accept': [
168+
'application/json'
169+
],
170+
'content_type': [
171+
'application/json'
172+
]
173+
},
174+
api_client=api_client,
175+
callable=__clear_task_instances
176+
)
177+
46178
def __get_dag(
47179
self,
48180
dag_id,

airflow_python_sdk/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7777
self.default_headers[header_name] = header_value
7878
self.cookie = cookie
7979
# Set default User-Agent.
80-
self.user_agent = 'OpenAPI-Generator/0.0.5/python'
80+
self.user_agent = 'OpenAPI-Generator/0.1.5/python'
8181

8282
def __enter__(self):
8383
return self

airflow_python_sdk/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def to_debug_report(self):
400400
"OS: {env}\n"\
401401
"Python Version: {pyversion}\n"\
402402
"Version of the API: 1.0.0\n"\
403-
"SDK Package Version: 0.0.5".\
403+
"SDK Package Version: 0.1.5".\
404404
format(env=sys.platform, pyversion=sys.version)
405405

406406
def get_host_settings(self):

0 commit comments

Comments
 (0)