This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b0cb76b6d8 Made usage of Path explicit for Edge Worker pid files 
(#43308)
3b0cb76b6d8 is described below

commit 3b0cb76b6d8c4dcbf0c4b1425a16d73660bb3f1f
Author: Oliver Wannenwetsch 
<[email protected]>
AuthorDate: Wed Oct 23 15:31:03 2024 +0200

    Made usage of Path explicit for Edge Worker pid files (#43308)
    
    * Made usage of Path explicit for Edge Worker pid files
    
    * Updated version number of Edge Worker provider package
    
    * Fixed pytests by findings of mypy
---
 providers/src/airflow/providers/edge/CHANGELOG.rst       | 8 ++++++++
 providers/src/airflow/providers/edge/cli/edge_command.py | 6 +++---
 providers/src/airflow/providers/edge/provider.yaml       | 4 ++--
 providers/tests/edge/cli/test_edge_command.py            | 2 +-
 providers/tests/edge/models/test_edge_worker.py          | 2 +-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/providers/src/airflow/providers/edge/CHANGELOG.rst 
b/providers/src/airflow/providers/edge/CHANGELOG.rst
index bdb34450d1c..56f2dc1243c 100644
--- a/providers/src/airflow/providers/edge/CHANGELOG.rst
+++ b/providers/src/airflow/providers/edge/CHANGELOG.rst
@@ -27,6 +27,14 @@
 Changelog
 ---------
 
+0.2.2re0
+.........
+
+Misc
+~~~~
+
+* ``Fixed type confusion for PID file paths (#43308)``
+
 0.2.1re0
 .........
 
diff --git a/providers/src/airflow/providers/edge/cli/edge_command.py 
b/providers/src/airflow/providers/edge/cli/edge_command.py
index 37ce931957b..1d5013703c3 100644
--- a/providers/src/airflow/providers/edge/cli/edge_command.py
+++ b/providers/src/airflow/providers/edge/cli/edge_command.py
@@ -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)
@@ -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,
diff --git a/providers/src/airflow/providers/edge/provider.yaml 
b/providers/src/airflow/providers/edge/provider.yaml
index f6e4cbde93d..32952295a97 100644
--- a/providers/src/airflow/providers/edge/provider.yaml
+++ b/providers/src/airflow/providers/edge/provider.yaml
@@ -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
diff --git a/providers/tests/edge/cli/test_edge_command.py 
b/providers/tests/edge/cli/test_edge_command.py
index 5014edea11d..51aad580680 100644
--- a/providers/tests/edge/cli/test_edge_command.py
+++ b/providers/tests/edge/cli/test_edge_command.py
@@ -120,7 +120,7 @@ class TestEdgeWorkerCli:
 
     @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
 
diff --git a/providers/tests/edge/models/test_edge_worker.py 
b/providers/tests/edge/models/test_edge_worker.py
index d67cfdbb2cd..20e394ffd57 100644
--- a/providers/tests/edge/models/test_edge_worker.py
+++ b/providers/tests/edge/models/test_edge_worker.py
@@ -39,7 +39,7 @@ pytestmark = pytest.mark.db_test
 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)

Reply via email to