apache-airflow-providers-edge3 2.0.0rc1__py3-none-any.whl → 3.0.1__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/api_client.py +30 -28
- airflow/providers/edge3/cli/dataclasses.py +3 -10
- airflow/providers/edge3/cli/definition.py +261 -0
- airflow/providers/edge3/cli/edge_command.py +8 -206
- airflow/providers/edge3/cli/worker.py +226 -198
- airflow/providers/edge3/example_dags/win_notepad.py +1 -1
- airflow/providers/edge3/executors/edge_executor.py +24 -49
- airflow/providers/edge3/get_provider_info.py +1 -0
- airflow/providers/edge3/models/edge_job.py +1 -2
- airflow/providers/edge3/models/edge_worker.py +61 -16
- airflow/providers/edge3/plugins/edge_executor_plugin.py +1 -1
- airflow/providers/edge3/plugins/www/dist/main.umd.cjs +8 -8
- airflow/providers/edge3/plugins/www/package.json +32 -27
- airflow/providers/edge3/plugins/www/pnpm-lock.yaml +1625 -1716
- airflow/providers/edge3/plugins/www/src/global.d.ts +24 -0
- airflow/providers/edge3/plugins/www/src/layouts/NavTabs.tsx +25 -3
- airflow/providers/edge3/plugins/www/src/main.tsx +6 -1
- airflow/providers/edge3/plugins/www/src/theme.ts +1 -1
- airflow/providers/edge3/worker_api/datamodels.py +12 -1
- airflow/providers/edge3/worker_api/routes/jobs.py +21 -8
- airflow/providers/edge3/worker_api/routes/logs.py +1 -1
- airflow/providers/edge3/worker_api/routes/worker.py +16 -3
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/METADATA +14 -10
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/RECORD +29 -29
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/licenses/NOTICE +1 -1
- airflow/providers/edge3/plugins/templates/edge_worker_hosts.html +0 -175
- airflow/providers/edge3/plugins/templates/edge_worker_jobs.html +0 -69
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/entry_points.txt +0 -0
- {apache_airflow_providers_edge3-2.0.0rc1.dist-info → apache_airflow_providers_edge3-3.0.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
# under the License.
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
+
import asyncio
|
|
19
20
|
import json
|
|
20
21
|
import logging
|
|
21
22
|
import os
|
|
@@ -30,7 +31,6 @@ from time import sleep, time
|
|
|
30
31
|
import psutil
|
|
31
32
|
|
|
32
33
|
from airflow import settings
|
|
33
|
-
from airflow.cli.cli_config import ARG_PID, ARG_VERBOSE, ActionCommand, Arg
|
|
34
34
|
from airflow.cli.commands.daemon_utils import run_command_with_daemon_option
|
|
35
35
|
from airflow.cli.simple_table import AirflowConsole
|
|
36
36
|
from airflow.configuration import conf
|
|
@@ -42,7 +42,6 @@ from airflow.providers.edge3.cli.signalling import (
|
|
|
42
42
|
pid_file_path,
|
|
43
43
|
status_file_path,
|
|
44
44
|
)
|
|
45
|
-
from airflow.providers.edge3.cli.worker import SIG_STATUS, EdgeWorker
|
|
46
45
|
from airflow.providers.edge3.models.edge_worker import EdgeWorkerState
|
|
47
46
|
from airflow.utils import cli as cli_utils
|
|
48
47
|
from airflow.utils.net import getfqdn
|
|
@@ -89,6 +88,8 @@ def _launch_worker(args):
|
|
|
89
88
|
print(settings.HEADER)
|
|
90
89
|
print(EDGE_WORKER_HEADER)
|
|
91
90
|
|
|
91
|
+
from airflow.providers.edge3.cli.worker import EdgeWorker
|
|
92
|
+
|
|
92
93
|
edge_worker = EdgeWorker(
|
|
93
94
|
pid_file_path=pid_file_path(args.pid),
|
|
94
95
|
hostname=args.edge_hostname or getfqdn(),
|
|
@@ -98,7 +99,7 @@ def _launch_worker(args):
|
|
|
98
99
|
heartbeat_interval=conf.getint("edge", "heartbeat_interval"),
|
|
99
100
|
daemon=args.daemon,
|
|
100
101
|
)
|
|
101
|
-
edge_worker.start()
|
|
102
|
+
asyncio.run(edge_worker.start())
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
@cli_utils.action_cli(check_db=False)
|
|
@@ -121,6 +122,8 @@ def worker(args):
|
|
|
121
122
|
@providers_configuration_loaded
|
|
122
123
|
def status(args):
|
|
123
124
|
"""Check for Airflow Local Edge Worker status."""
|
|
125
|
+
from airflow.providers.edge3.cli.worker import SIG_STATUS
|
|
126
|
+
|
|
124
127
|
pid = get_pid(args.pid)
|
|
125
128
|
|
|
126
129
|
# Send Signal as notification to drop status JSON
|
|
@@ -147,6 +150,8 @@ def status(args):
|
|
|
147
150
|
@providers_configuration_loaded
|
|
148
151
|
def maintenance(args):
|
|
149
152
|
"""Set or Unset maintenance mode of local edge worker."""
|
|
153
|
+
from airflow.providers.edge3.cli.worker import SIG_STATUS
|
|
154
|
+
|
|
150
155
|
if args.maintenance == "on" and not args.comments:
|
|
151
156
|
logger.error("Comments are required when setting maintenance mode.")
|
|
152
157
|
sys.exit(4)
|
|
@@ -422,206 +427,3 @@ def remove_worker_queues(args) -> None:
|
|
|
422
427
|
except TypeError as e:
|
|
423
428
|
logger.error(str(e))
|
|
424
429
|
raise SystemExit
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
ARG_CONCURRENCY = Arg(
|
|
428
|
-
("-c", "--concurrency"),
|
|
429
|
-
type=int,
|
|
430
|
-
help="The number of worker processes",
|
|
431
|
-
default=conf.getint("edge", "worker_concurrency", fallback=8),
|
|
432
|
-
)
|
|
433
|
-
ARG_QUEUES = Arg(
|
|
434
|
-
("-q", "--queues"),
|
|
435
|
-
help="Comma delimited list of queues to serve, serve all queues if not provided.",
|
|
436
|
-
)
|
|
437
|
-
ARG_EDGE_HOSTNAME = Arg(
|
|
438
|
-
("-H", "--edge-hostname"),
|
|
439
|
-
help="Set the hostname of worker if you have multiple workers on a single machine",
|
|
440
|
-
)
|
|
441
|
-
ARG_REQUIRED_EDGE_HOSTNAME = Arg(
|
|
442
|
-
("-H", "--edge-hostname"),
|
|
443
|
-
help="Set the hostname of worker if you have multiple workers on a single machine",
|
|
444
|
-
required=True,
|
|
445
|
-
)
|
|
446
|
-
ARG_MAINTENANCE = Arg(("maintenance",), help="Desired maintenance state", choices=("on", "off"))
|
|
447
|
-
ARG_MAINTENANCE_COMMENT = Arg(
|
|
448
|
-
("-c", "--comments"),
|
|
449
|
-
help="Maintenance comments to report reason. Required if maintenance is turned on.",
|
|
450
|
-
)
|
|
451
|
-
ARG_REQUIRED_MAINTENANCE_COMMENT = Arg(
|
|
452
|
-
("-c", "--comments"),
|
|
453
|
-
help="Maintenance comments to report reason. Required if enabling maintenance",
|
|
454
|
-
required=True,
|
|
455
|
-
)
|
|
456
|
-
ARG_QUEUES_MANAGE = Arg(
|
|
457
|
-
("-q", "--queues"),
|
|
458
|
-
help="Comma delimited list of queues to add or remove.",
|
|
459
|
-
required=True,
|
|
460
|
-
)
|
|
461
|
-
ARG_WAIT_MAINT = Arg(
|
|
462
|
-
("-w", "--wait"),
|
|
463
|
-
default=False,
|
|
464
|
-
help="Wait until edge worker has reached desired state.",
|
|
465
|
-
action="store_true",
|
|
466
|
-
)
|
|
467
|
-
ARG_WAIT_STOP = Arg(
|
|
468
|
-
("-w", "--wait"),
|
|
469
|
-
default=False,
|
|
470
|
-
help="Wait until edge worker is shut down.",
|
|
471
|
-
action="store_true",
|
|
472
|
-
)
|
|
473
|
-
ARG_OUTPUT = Arg(
|
|
474
|
-
(
|
|
475
|
-
"-o",
|
|
476
|
-
"--output",
|
|
477
|
-
),
|
|
478
|
-
help="Output format. Allowed values: json, yaml, plain, table (default: table)",
|
|
479
|
-
metavar="(table, json, yaml, plain)",
|
|
480
|
-
choices=("table", "json", "yaml", "plain"),
|
|
481
|
-
default="table",
|
|
482
|
-
)
|
|
483
|
-
ARG_STATE = Arg(
|
|
484
|
-
(
|
|
485
|
-
"-s",
|
|
486
|
-
"--state",
|
|
487
|
-
),
|
|
488
|
-
nargs="+",
|
|
489
|
-
help="State of the edge worker",
|
|
490
|
-
)
|
|
491
|
-
|
|
492
|
-
ARG_DAEMON = Arg(
|
|
493
|
-
("-D", "--daemon"), help="Daemonize instead of running in the foreground", action="store_true"
|
|
494
|
-
)
|
|
495
|
-
ARG_UMASK = Arg(
|
|
496
|
-
("-u", "--umask"),
|
|
497
|
-
help="Set the umask of edge worker in daemon mode",
|
|
498
|
-
)
|
|
499
|
-
ARG_STDERR = Arg(("--stderr",), help="Redirect stderr to this file if run in daemon mode")
|
|
500
|
-
ARG_STDOUT = Arg(("--stdout",), help="Redirect stdout to this file if run in daemon mode")
|
|
501
|
-
ARG_LOG_FILE = Arg(("-l", "--log-file"), help="Location of the log file if run in daemon mode")
|
|
502
|
-
ARG_YES = Arg(
|
|
503
|
-
("-y", "--yes"),
|
|
504
|
-
help="Skip confirmation prompt and proceed with shutdown",
|
|
505
|
-
action="store_true",
|
|
506
|
-
default=False,
|
|
507
|
-
)
|
|
508
|
-
|
|
509
|
-
EDGE_COMMANDS: list[ActionCommand] = [
|
|
510
|
-
ActionCommand(
|
|
511
|
-
name=worker.__name__,
|
|
512
|
-
help=worker.__doc__,
|
|
513
|
-
func=worker,
|
|
514
|
-
args=(
|
|
515
|
-
ARG_CONCURRENCY,
|
|
516
|
-
ARG_QUEUES,
|
|
517
|
-
ARG_EDGE_HOSTNAME,
|
|
518
|
-
ARG_PID,
|
|
519
|
-
ARG_VERBOSE,
|
|
520
|
-
ARG_DAEMON,
|
|
521
|
-
ARG_STDOUT,
|
|
522
|
-
ARG_STDERR,
|
|
523
|
-
ARG_LOG_FILE,
|
|
524
|
-
ARG_UMASK,
|
|
525
|
-
),
|
|
526
|
-
),
|
|
527
|
-
ActionCommand(
|
|
528
|
-
name=status.__name__,
|
|
529
|
-
help=status.__doc__,
|
|
530
|
-
func=status,
|
|
531
|
-
args=(
|
|
532
|
-
ARG_PID,
|
|
533
|
-
ARG_VERBOSE,
|
|
534
|
-
),
|
|
535
|
-
),
|
|
536
|
-
ActionCommand(
|
|
537
|
-
name=maintenance.__name__,
|
|
538
|
-
help=maintenance.__doc__,
|
|
539
|
-
func=maintenance,
|
|
540
|
-
args=(
|
|
541
|
-
ARG_MAINTENANCE,
|
|
542
|
-
ARG_MAINTENANCE_COMMENT,
|
|
543
|
-
ARG_WAIT_MAINT,
|
|
544
|
-
ARG_PID,
|
|
545
|
-
ARG_VERBOSE,
|
|
546
|
-
),
|
|
547
|
-
),
|
|
548
|
-
ActionCommand(
|
|
549
|
-
name=stop.__name__,
|
|
550
|
-
help=stop.__doc__,
|
|
551
|
-
func=stop,
|
|
552
|
-
args=(
|
|
553
|
-
ARG_WAIT_STOP,
|
|
554
|
-
ARG_PID,
|
|
555
|
-
ARG_VERBOSE,
|
|
556
|
-
),
|
|
557
|
-
),
|
|
558
|
-
ActionCommand(
|
|
559
|
-
name="list-workers",
|
|
560
|
-
help=list_edge_workers.__doc__,
|
|
561
|
-
func=list_edge_workers,
|
|
562
|
-
args=(
|
|
563
|
-
ARG_OUTPUT,
|
|
564
|
-
ARG_STATE,
|
|
565
|
-
),
|
|
566
|
-
),
|
|
567
|
-
ActionCommand(
|
|
568
|
-
name="remote-edge-worker-request-maintenance",
|
|
569
|
-
help=put_remote_worker_on_maintenance.__doc__,
|
|
570
|
-
func=put_remote_worker_on_maintenance,
|
|
571
|
-
args=(
|
|
572
|
-
ARG_REQUIRED_EDGE_HOSTNAME,
|
|
573
|
-
ARG_REQUIRED_MAINTENANCE_COMMENT,
|
|
574
|
-
),
|
|
575
|
-
),
|
|
576
|
-
ActionCommand(
|
|
577
|
-
name="remote-edge-worker-exit-maintenance",
|
|
578
|
-
help=remove_remote_worker_from_maintenance.__doc__,
|
|
579
|
-
func=remove_remote_worker_from_maintenance,
|
|
580
|
-
args=(ARG_REQUIRED_EDGE_HOSTNAME,),
|
|
581
|
-
),
|
|
582
|
-
ActionCommand(
|
|
583
|
-
name="remote-edge-worker-update-maintenance-comment",
|
|
584
|
-
help=remote_worker_update_maintenance_comment.__doc__,
|
|
585
|
-
func=remote_worker_update_maintenance_comment,
|
|
586
|
-
args=(
|
|
587
|
-
ARG_REQUIRED_EDGE_HOSTNAME,
|
|
588
|
-
ARG_REQUIRED_MAINTENANCE_COMMENT,
|
|
589
|
-
),
|
|
590
|
-
),
|
|
591
|
-
ActionCommand(
|
|
592
|
-
name="remove-remote-edge-worker",
|
|
593
|
-
help=remove_remote_worker.__doc__,
|
|
594
|
-
func=remove_remote_worker,
|
|
595
|
-
args=(ARG_REQUIRED_EDGE_HOSTNAME,),
|
|
596
|
-
),
|
|
597
|
-
ActionCommand(
|
|
598
|
-
name="shutdown-remote-edge-worker",
|
|
599
|
-
help=remote_worker_request_shutdown.__doc__,
|
|
600
|
-
func=remote_worker_request_shutdown,
|
|
601
|
-
args=(ARG_REQUIRED_EDGE_HOSTNAME,),
|
|
602
|
-
),
|
|
603
|
-
ActionCommand(
|
|
604
|
-
name="add-worker-queues",
|
|
605
|
-
help=add_worker_queues.__doc__,
|
|
606
|
-
func=add_worker_queues,
|
|
607
|
-
args=(
|
|
608
|
-
ARG_REQUIRED_EDGE_HOSTNAME,
|
|
609
|
-
ARG_QUEUES_MANAGE,
|
|
610
|
-
),
|
|
611
|
-
),
|
|
612
|
-
ActionCommand(
|
|
613
|
-
name="remove-worker-queues",
|
|
614
|
-
help=remove_worker_queues.__doc__,
|
|
615
|
-
func=remove_worker_queues,
|
|
616
|
-
args=(
|
|
617
|
-
ARG_REQUIRED_EDGE_HOSTNAME,
|
|
618
|
-
ARG_QUEUES_MANAGE,
|
|
619
|
-
),
|
|
620
|
-
),
|
|
621
|
-
ActionCommand(
|
|
622
|
-
name="shutdown-all-workers",
|
|
623
|
-
help=shutdown_all_workers.__doc__,
|
|
624
|
-
func=shutdown_all_workers,
|
|
625
|
-
args=(ARG_YES,),
|
|
626
|
-
),
|
|
627
|
-
]
|