apache-airflow-providers-edge3 1.1.3__py3-none-any.whl → 1.2.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/edge3/__init__.py +1 -1
- airflow/providers/edge3/cli/worker.py +6 -2
- airflow/providers/edge3/example_dags/integration_test.py +6 -2
- airflow/providers/edge3/example_dags/win_test.py +6 -1
- airflow/providers/edge3/openapi/v2-edge-generated.yaml +1138 -0
- airflow/providers/edge3/plugins/edge_executor_plugin.py +43 -3
- airflow/providers/edge3/plugins/www/.gitignore +27 -0
- airflow/providers/edge3/plugins/www/.prettierignore +6 -0
- airflow/providers/edge3/plugins/www/.prettierrc +13 -0
- airflow/providers/edge3/plugins/www/README.md +141 -0
- airflow/providers/edge3/plugins/www/dist/main.d.ts +1 -0
- airflow/providers/edge3/plugins/www/dist/main.umd.cjs +124 -0
- airflow/providers/edge3/plugins/www/eslint.config.js +54 -0
- airflow/providers/edge3/plugins/www/index.html +13 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/common.ts +33 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/ensureQueryData.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/index.ts +4 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/infiniteQueries.ts +2 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/prefetch.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/queries.ts +87 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/suspense.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiError.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiRequestOptions.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiResult.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/CancelablePromise.ts +126 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/OpenAPI.ts +57 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/request.ts +347 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/index.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/schemas.gen.ts +700 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/services.gen.ts +289 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/types.gen.ts +655 -0
- airflow/providers/edge3/plugins/www/package.json +80 -0
- airflow/providers/edge3/plugins/www/pnpm-lock.yaml +6653 -0
- airflow/providers/edge3/plugins/www/src/components/ErrorAlert.tsx +66 -0
- airflow/providers/edge3/plugins/www/src/components/StateBadge.tsx +43 -0
- airflow/providers/edge3/plugins/www/src/components/StateIcon.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateBadge.tsx +71 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateIcon.tsx +57 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Alert.tsx +62 -0
- airflow/providers/edge3/plugins/www/src/components/ui/CloseButton.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/components/ui/index.ts +20 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/ColorModeProvider.tsx +24 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/index.ts +21 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/useColorMode.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/dev.tsx +29 -0
- airflow/providers/edge3/plugins/www/src/layouts/EdgeLayout.tsx +44 -0
- airflow/providers/edge3/plugins/www/src/layouts/NavTabs.tsx +63 -0
- airflow/providers/edge3/plugins/www/src/main.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/pages/JobsPage.tsx +88 -0
- airflow/providers/edge3/plugins/www/src/pages/WorkerPage.tsx +105 -0
- airflow/providers/edge3/plugins/www/src/res/README.md +24 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer-dark.svg +3 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer.svg +3 -0
- airflow/providers/edge3/plugins/www/src/theme.ts +176 -0
- airflow/providers/edge3/plugins/www/src/utils/config.ts +23 -0
- airflow/providers/edge3/plugins/www/src/utils/index.ts +22 -0
- airflow/providers/edge3/plugins/www/src/utils/tokenHandler.ts +51 -0
- airflow/providers/edge3/plugins/www/src/utils/useContainerWidth.ts +43 -0
- airflow/providers/edge3/plugins/www/src/vite-env.d.ts +20 -0
- airflow/providers/edge3/plugins/www/testsSetup.ts +19 -0
- airflow/providers/edge3/plugins/www/tsconfig.app.json +31 -0
- airflow/providers/edge3/plugins/www/tsconfig.json +8 -0
- airflow/providers/edge3/plugins/www/tsconfig.lib.json +15 -0
- airflow/providers/edge3/plugins/www/tsconfig.node.json +29 -0
- airflow/providers/edge3/plugins/www/vite.config.ts +95 -0
- airflow/providers/edge3/version_compat.py +1 -0
- airflow/providers/edge3/worker_api/app.py +34 -8
- airflow/providers/edge3/worker_api/datamodels_ui.py +67 -0
- airflow/providers/edge3/worker_api/routes/health.py +1 -1
- airflow/providers/edge3/worker_api/routes/ui.py +102 -0
- {apache_airflow_providers_edge3-1.1.3.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/METADATA +8 -9
- apache_airflow_providers_edge3-1.2.0rc1.dist-info/RECORD +103 -0
- apache_airflow_providers_edge3-1.1.3.dist-info/RECORD +0 -41
- {apache_airflow_providers_edge3-1.1.3.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-1.1.3.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/entry_points.txt +0 -0
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, Any
|
|
23
23
|
from airflow.configuration import conf
|
24
24
|
from airflow.exceptions import AirflowConfigException
|
25
25
|
from airflow.plugins_manager import AirflowPlugin
|
26
|
-
from airflow.providers.edge3.version_compat import AIRFLOW_V_3_0_PLUS
|
26
|
+
from airflow.providers.edge3.version_compat import AIRFLOW_V_3_0_PLUS, AIRFLOW_V_3_1_PLUS
|
27
27
|
from airflow.utils.session import NEW_SESSION, provide_session
|
28
28
|
|
29
29
|
if TYPE_CHECKING:
|
@@ -49,8 +49,8 @@ if AIRFLOW_V_3_0_PLUS:
|
|
49
49
|
|
50
50
|
return {
|
51
51
|
"app": create_edge_worker_api_app(),
|
52
|
-
"url_prefix": "/edge_worker
|
53
|
-
"name": "Airflow Edge Worker
|
52
|
+
"url_prefix": "/edge_worker",
|
53
|
+
"name": "Airflow Edge Worker",
|
54
54
|
}
|
55
55
|
|
56
56
|
else:
|
@@ -232,9 +232,49 @@ class EdgeExecutorPlugin(AirflowPlugin):
|
|
232
232
|
|
233
233
|
name = "edge_executor"
|
234
234
|
if EDGE_EXECUTOR_ACTIVE and RUNNING_ON_APISERVER:
|
235
|
+
if AIRFLOW_V_3_1_PLUS:
|
236
|
+
fastapi_apps = [_get_api_endpoint()]
|
237
|
+
react_apps = [
|
238
|
+
{
|
239
|
+
"name": "Edge Worker",
|
240
|
+
"bundle_url": "/edge_worker/static/main.umd.cjs",
|
241
|
+
"destination": "nav",
|
242
|
+
"url_route": "edge_worker",
|
243
|
+
"category": "admin",
|
244
|
+
"icon": "/edge_worker/res/cloud-computer.svg",
|
245
|
+
"icon_dark_mode": "/edge_worker/res/cloud-computer-dark.svg",
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"name": "Edge Worker Jobs",
|
249
|
+
"bundle_url": "/edge_worker/static/main.umd.cjs",
|
250
|
+
"url_route": "edge_jobs",
|
251
|
+
"category": "admin",
|
252
|
+
"icon": "/edge_worker/res/cloud-computer.svg",
|
253
|
+
"icon_dark_mode": "/edge_worker/res/cloud-computer-dark.svg",
|
254
|
+
},
|
255
|
+
]
|
256
|
+
external_views = [
|
257
|
+
{
|
258
|
+
"name": "Edge Worker API docs",
|
259
|
+
"href": "/edge_worker/docs",
|
260
|
+
"destination": "nav",
|
261
|
+
"category": "docs",
|
262
|
+
"icon": "/edge_worker/res/cloud-computer.svg",
|
263
|
+
"icon_dark_mode": "/edge_worker/res/cloud-computer-dark.svg",
|
264
|
+
"url_route": "edge_worker_api_docs",
|
265
|
+
}
|
266
|
+
]
|
235
267
|
if AIRFLOW_V_3_0_PLUS:
|
268
|
+
# Airflow 3.0 does not know about react_apps, so we only provide the API endpoint
|
236
269
|
fastapi_apps = [_get_api_endpoint()]
|
237
270
|
else:
|
271
|
+
appbuilder_menu_items = [
|
272
|
+
{
|
273
|
+
"name": "Edge Worker API docs",
|
274
|
+
"href": "/edge_worker/v1/ui",
|
275
|
+
"category": "Docs",
|
276
|
+
}
|
277
|
+
]
|
238
278
|
appbuilder_views = [
|
239
279
|
{
|
240
280
|
"name": "Edge Worker Jobs",
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Logs
|
2
|
+
logs
|
3
|
+
*.log
|
4
|
+
npm-debug.log*
|
5
|
+
yarn-debug.log*
|
6
|
+
yarn-error.log*
|
7
|
+
pnpm-debug.log*
|
8
|
+
lerna-debug.log*
|
9
|
+
|
10
|
+
node_modules
|
11
|
+
.pnpm-store
|
12
|
+
dist-ssr
|
13
|
+
*.local
|
14
|
+
|
15
|
+
# Editor directories and files
|
16
|
+
.vscode/*
|
17
|
+
!.vscode/extensions.json
|
18
|
+
.idea
|
19
|
+
.DS_Store
|
20
|
+
*.suo
|
21
|
+
*.ntvs*
|
22
|
+
*.njsproj
|
23
|
+
*.sln
|
24
|
+
*.sw?
|
25
|
+
|
26
|
+
# Coverage
|
27
|
+
coverage
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json.schemastore.org/prettierrc",
|
3
|
+
"endOfLine": "lf",
|
4
|
+
"importOrder": ["<THIRD_PARTY_MODULES>", "^src/", "^[./]"],
|
5
|
+
"importOrderSeparation": true,
|
6
|
+
"jsxSingleQuote": false,
|
7
|
+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
|
8
|
+
"printWidth": 110,
|
9
|
+
"singleQuote": false,
|
10
|
+
"tabWidth": 2,
|
11
|
+
"trailingComma": "all",
|
12
|
+
"useTabs": false
|
13
|
+
}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
<!--
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
-->
|
19
|
+
|
20
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
21
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
22
|
+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
23
|
+
|
24
|
+
- [Edge](#edge-provider-ui-plugin)
|
25
|
+
- [Development](#development)
|
26
|
+
- [Best Practices](#best-practices)
|
27
|
+
- [Troubleshooting](#troubleshooting)
|
28
|
+
|
29
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
30
|
+
|
31
|
+
# Edge Provider UI plugin
|
32
|
+
|
33
|
+
This is a React plugin template for Apache Airflow that builds as a library component for UI to provide details of Edge workers.
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
This template is configured to build your React component as a library that can be consumed by other applications.
|
38
|
+
|
39
|
+
### Available Scripts
|
40
|
+
|
41
|
+
- `pnpm dev` - Start development server with hot reload
|
42
|
+
- `pnpm build` - Build the library for production
|
43
|
+
- `pnpm build:types` - Generate TypeScript declaration files only
|
44
|
+
- `pnpm build:lib` - Build the JavaScript library only
|
45
|
+
- `pnpm test` - Run tests
|
46
|
+
- `pnpm lint` - Check code quality
|
47
|
+
- `pnpm format` - Format code
|
48
|
+
|
49
|
+
### Library Output
|
50
|
+
|
51
|
+
When you run `pnpm build`, the template generates:
|
52
|
+
|
53
|
+
- `dist/main.js` - ES module JavaScript library
|
54
|
+
- `dist/main.d.ts` - TypeScript declaration file
|
55
|
+
- Source maps for debugging
|
56
|
+
|
57
|
+
### Usage as a Library
|
58
|
+
|
59
|
+
After building, other applications can import your component:
|
60
|
+
|
61
|
+
```typescript
|
62
|
+
import { PluginComponent } from 'your-plugin-name';
|
63
|
+
|
64
|
+
// Use in your React app
|
65
|
+
<PluginComponent />
|
66
|
+
```
|
67
|
+
|
68
|
+
### Development Mode
|
69
|
+
|
70
|
+
For development and testing, use `pnpm dev` which will:
|
71
|
+
|
72
|
+
- Start a development server on port 5173
|
73
|
+
- Load the component using `src/dev.tsx` entry point
|
74
|
+
- Enable hot module replacement
|
75
|
+
|
76
|
+
To have a usable UI, please start Airflow also in parallel via
|
77
|
+
`breeze start-airflow`.
|
78
|
+
|
79
|
+
### Library Configuration
|
80
|
+
|
81
|
+
The template is configured with:
|
82
|
+
|
83
|
+
- **Vite** for fast building and development
|
84
|
+
- **TypeScript** with declaration file generation
|
85
|
+
- **CSS injection** - styles are automatically injected into the JavaScript bundle
|
86
|
+
- **External dependencies** - React and other common libraries are marked as external to reduce bundle size
|
87
|
+
|
88
|
+
### Customization
|
89
|
+
|
90
|
+
1. **Component Props**: Update the `PluginComponentProps` interface in `src/main.tsx`
|
91
|
+
2. **External Dependencies**: Modify the `external` array in `vite.config.ts`
|
92
|
+
3. **Build Output**: Adjust library configuration in `vite.config.ts`
|
93
|
+
|
94
|
+
### Package Configuration
|
95
|
+
|
96
|
+
The `package.json` is configured with:
|
97
|
+
|
98
|
+
- `main` and `module` pointing to the built library
|
99
|
+
- `types` pointing to generated declaration files
|
100
|
+
- `exports` for modern import/export support
|
101
|
+
- `files` array specifying what gets published
|
102
|
+
|
103
|
+
This ensures your plugin can be consumed as both a CommonJS and ES module with full TypeScript support.
|
104
|
+
|
105
|
+
## Best Practices
|
106
|
+
|
107
|
+
1. **Keep React External**: Always mark React ecosystem as external to avoid conflicts
|
108
|
+
2. **Global Naming**: Use standardized global name (`AirflowPlugin`) for consistency
|
109
|
+
3. **Error Handling**: Implement proper error boundaries and fallbacks
|
110
|
+
4. **TypeScript**: Use proper typing for plugin props and exports
|
111
|
+
5. **Bundle Size**: Monitor bundle size and externalize large dependencies if needed
|
112
|
+
|
113
|
+
## Troubleshooting
|
114
|
+
|
115
|
+
### Common Issues
|
116
|
+
|
117
|
+
**"Failed to resolve module specifier 'react'"**
|
118
|
+
|
119
|
+
- Ensure React is marked as external in `vite.config.ts`
|
120
|
+
- Verify host application exposes React globally
|
121
|
+
|
122
|
+
**"Cannot read properties of null (reading 'useState')"**
|
123
|
+
|
124
|
+
- React instance mismatch - check external configuration
|
125
|
+
- Verify global React is properly set in host application
|
126
|
+
|
127
|
+
**"Objects are not valid as a React child"**
|
128
|
+
|
129
|
+
- Ensure you're returning component functions, not JSX elements
|
130
|
+
- Check that lazy loading returns proper component structure
|
131
|
+
|
132
|
+
**MIME type issues**
|
133
|
+
|
134
|
+
- Ensure `.js` and `.cjs` files are served with correct MIME type
|
135
|
+
|
136
|
+
For more help, check the main project documentation.
|
137
|
+
|
138
|
+
### Deployment to Airflow Plugins
|
139
|
+
|
140
|
+
Once the development is complete, you can build the library using `pnpm build` and then host the content of the `dist` folder. You can do that on your own infrastructure or within airflow
|
141
|
+
by adding static file serving to your api server via registering a plugin `fastapi_apps`. You can take a look at the [Airflow documentation](https://airflow.apache.org/docs/apache-airflow/stable/plugins.html) for more information on how to do that.
|
@@ -0,0 +1 @@
|
|
1
|
+
export {}
|