-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update to 5.7.0 (#95) * Update version and submodule dependecy to 5.7.0 * Use tab instead * use streamlined branch name * Add missing urllib3 dependency (#99) * Add missing dependency on urllib3 (#98) * Add missing urllib3 dependency * Do not use version >2 * Bump version * Bump to 5.7.1 * DataSource Audit: pass run_id from env variable (#102) * flight meta middleware for extra metadata * iteration on comments + add run id to http requests * moving run id to parameter input * adding client source environment variable * cleanup * updating pyproject version (#109) --------- Co-authored-by: ddl-gabrielhaim <[email protected]> Co-authored-by: Gabriel Haim <[email protected]>
- Loading branch information
1 parent
18e8b15
commit 8596f4b
Showing
4 changed files
with
121 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" Classes to augment headers with metadata for HTTP and Flight requests.""" | ||
|
||
from typing import Optional | ||
|
||
import attr | ||
from pyarrow import flight | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class MetaMiddlewareFactory(flight.ClientMiddlewareFactory): | ||
"""Middleware Factory for metadata.""" | ||
|
||
client_source: Optional[str] = attr.ib() | ||
run_id: Optional[str] = attr.ib() | ||
|
||
def start_call(self, _): | ||
"""Called at the start of an RPC.""" | ||
return MetaMiddleware(self.client_source, self.run_id) | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class MetaMiddleware(flight.ClientMiddleware): | ||
"""Middleware for authenticating flight requests.""" | ||
|
||
client_source: Optional[str] = attr.ib() | ||
run_id: Optional[str] = attr.ib() | ||
|
||
def call_completed(self, _): | ||
"""No implementation. TODO logging.""" | ||
|
||
def received_headers(self, _): | ||
"""No implementation.""" | ||
|
||
def sending_headers(self): | ||
"""Return metadata headers.""" | ||
headers = {} | ||
|
||
if self.client_source is not None: | ||
headers["x-domino-client-source"] = self.client_source | ||
if self.run_id is not None: | ||
headers["x-domino-run-id"] = self.run_id | ||
|
||
return headers |
Oops, something went wrong.