Skip to content

Commit

Permalink
Made usage of Path explicit for Edge Worker pid files (apache#43308)
Browse files Browse the repository at this point in the history
* Made usage of Path explicit for Edge Worker pid files

* Updated version number of Edge Worker provider package

* Fixed pytests by findings of mypy
  • Loading branch information
OliverWannenwetsch authored and harjeevanmaan committed Oct 23, 2024
1 parent 975e27c commit abc19b6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions providers/src/airflow/providers/edge/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
Changelog
---------

0.2.2re0
.........

Misc
~~~~

* ``Fixed type confusion for PID file paths (#43308)``

0.2.1re0
.........

Expand Down
6 changes: 3 additions & 3 deletions providers/src/airflow/providers/edge/cli/edge_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def _pid_file_path(pid_file: str | None) -> str:
return cli_utils.setup_locations(process=EDGE_WORKER_PROCESS_NAME, pid=pid_file)[0]


def _write_pid_to_pidfile(pid_file_path):
def _write_pid_to_pidfile(pid_file_path: str):
"""Write PIDs for Edge Workers to disk, handling existing PID files."""
if pid_file_path.exists():
if Path(pid_file_path).exists():
# Handle existing PID files on disk
logger.info("An existing PID file has been found: %s.", pid_file_path)
pid_stored_in_pid_file = read_pid_from_pidfile(pid_file_path)
Expand Down Expand Up @@ -142,7 +142,7 @@ class _EdgeWorkerCli:

def __init__(
self,
pid_file_path: Path,
pid_file_path: str,
hostname: str,
queues: list[str] | None,
concurrency: int,
Expand Down
4 changes: 2 additions & 2 deletions providers/src/airflow/providers/edge/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ description: |
Handle edge workers on remote sites via HTTP(s) connection and orchestrates work over distributed sites
state: not-ready
source-date-epoch: 1729588146
source-date-epoch: 1729683247
# note that those versions are maintained by release manager - do not update them manually
versions:
- 0.2.1pre0
- 0.2.2pre0

dependencies:
- apache-airflow>=2.10.0
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/edge/cli/test_edge_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def returncode(self):

@pytest.fixture
def worker_with_job(self, tmp_path: Path, dummy_joblist: list[_Job]) -> _EdgeWorkerCli:
test_worker = _EdgeWorkerCli(tmp_path / "dummy.pid", "dummy", None, 8, 5, 5)
test_worker = _EdgeWorkerCli(str(tmp_path / "dummy.pid"), "dummy", None, 8, 5, 5)
test_worker.jobs = dummy_joblist
return test_worker

Expand Down
2 changes: 1 addition & 1 deletion providers/tests/edge/models/test_edge_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class TestEdgeWorker:
@pytest.fixture
def cli_worker(self, tmp_path: Path) -> _EdgeWorkerCli:
test_worker = _EdgeWorkerCli(tmp_path / "dummy.pid", "dummy", None, 8, 5, 5)
test_worker = _EdgeWorkerCli(str(tmp_path / "dummy.pid"), "dummy", None, 8, 5, 5)
return test_worker

@pytest.fixture(autouse=True)
Expand Down

0 comments on commit abc19b6

Please sign in to comment.