Skip to content

Commit

Permalink
allow https url for spark ingestion jar (#1266)
Browse files Browse the repository at this point in the history
* allow https url for spark ingestion jar

Signed-off-by: Jacob Klegar <[email protected]>

* lint

Signed-off-by: Jacob Klegar <[email protected]>
  • Loading branch information
jklegar authored Jan 18, 2021
1 parent cd57909 commit 7561970
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions sdk/python/feast/pyspark/launchers/aws/emr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def _random_string(length) -> str:
return "".join(random.choice(string.ascii_lowercase) for _ in range(length))


def _upload_jar(jar_s3_prefix: str, local_path: str) -> str:
with open(local_path, "rb") as f:
uri = urlparse(os.path.join(jar_s3_prefix, os.path.basename(local_path)))
def _upload_jar(jar_s3_prefix: str, jar_path: str) -> str:
if jar_path.startswith("https://"):
return jar_path
with open(jar_path, "rb") as f:
uri = urlparse(os.path.join(jar_s3_prefix, os.path.basename(jar_path)))
return urlunparse(
get_staging_client(uri.scheme).upload_fileobj(
f, local_path, remote_uri=uri,
)
get_staging_client(uri.scheme).upload_fileobj(f, jar_path, remote_uri=uri)
)


Expand Down
6 changes: 5 additions & 1 deletion sdk/python/feast/pyspark/launchers/k8s/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ def historical_feature_retrieval(
return cast(RetrievalJob, self._job_from_job_info(job_info))

def _upload_jar(self, jar_path: str) -> str:
if jar_path.startswith("s3://") or jar_path.startswith("s3a://"):
if (
jar_path.startswith("s3://")
or jar_path.startswith("s3a://")
or jar_path.startswith("https://")
):
return jar_path
elif jar_path.startswith("file://"):
local_jar_path = urlparse(jar_path).path
Expand Down

0 comments on commit 7561970

Please sign in to comment.