Skip to content

Commit

Permalink
the key for worker metadata is just "metadata"
Browse files Browse the repository at this point in the history
  • Loading branch information
abrookins committed Nov 9, 2024
1 parent 6c45d95 commit ae3e2a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/prefect/client/orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2613,10 +2613,12 @@ async def send_worker_heartbeat(
"heartbeat_interval_seconds": heartbeat_interval_seconds,
}
if worker_metadata:
params["worker_metadata"] = worker_metadata.model_dump(mode="json")
params["metadata"] = worker_metadata.model_dump(mode="json")
if get_worker_id:
params["return_id"] = get_worker_id

print(f"params: {params}")

resp = await self._client.post(
f"/work_pools/{work_pool_name}/workers/heartbeat",
json=params,
Expand Down
2 changes: 1 addition & 1 deletion tests/client/test_prefect_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,7 @@ async def test_worker_heartbeat_sends_metadata_if_passed(
assert mock_post.call_args[1]["json"] == {
"name": "test-worker",
"heartbeat_interval_seconds": 10,
"worker_metadata": {
"metadata": {
"integrations": [{"name": "prefect-aws", "version": "1.0.0"}]
},
}
Expand Down
4 changes: 2 additions & 2 deletions tests/workers/test_base_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ async def test_worker_heartbeat_sends_integrations(
json={
"name": worker.name,
"heartbeat_interval_seconds": worker.heartbeat_interval_seconds,
"worker_metadata": {
"metadata": {
"integrations": [
{"name": "prefect-aws", "version": "1.0.0"}
]
Expand Down Expand Up @@ -1972,7 +1972,7 @@ async def _worker_metadata(self) -> WorkerMetadata:
json={
"name": worker.name,
"heartbeat_interval_seconds": worker.heartbeat_interval_seconds,
"worker_metadata": {
"metadata": {
"integrations": [
{"name": "prefect-aws", "version": "1.0.0"}
],
Expand Down

0 comments on commit ae3e2a9

Please sign in to comment.