Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #37 from d33bs/main
Browse files Browse the repository at this point in the history
Minor Objstr Task Updates; Version Bump
  • Loading branch information
d33bs authored Feb 15, 2022
2 parents ab9efae + 6581fc6 commit 60b2ea6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minio
nose
pandas
pandavro==1.6.0
prefect==0.15.11
prefect==0.15.13
pyarrow==6.0.1
pygrok
pylint
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# This call to setup() does all the work
setuptools.setup(
name="cupyopt",
version="0.15.11.2",
version="0.15.13.1",
description="CU Python Opinionated Prefect Tasks",
long_description=README,
long_description_content_type="text/x-rst",
Expand Down
19 changes: 14 additions & 5 deletions src/cupyopt/objectstore_tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" object store functions """

import logging
import os
from typing import Any
from typing_extensions import Literal

Expand Down Expand Up @@ -211,27 +212,31 @@ def __init__(
self,
client: Minio = None,
bucket_name: str = None,
object_name: str = None,
file_path: str = None,
object_name: str = None,
**kwargs: Any
):

self.client = client
self.bucket_name = bucket_name
self.object_name = object_name
self.file_path = file_path
self.object_name = object_name

super().__init__(**kwargs)

@defaults_from_attrs("client", "bucket_name", "object_name", "file_path")
@defaults_from_attrs("client", "bucket_name", "file_path", "object_name")
def run(
self,
client: Minio,
bucket_name: str,
object_name: str,
file_path: str,
object_name: str = None,
):

# if no object_name is provided, default to file_path basename
if not object_name:
object_name = os.path.basename(file_path)

# upload file as object
client.fput_object(
bucket_name=bucket_name,
Expand Down Expand Up @@ -261,7 +266,9 @@ def __init__(
super().__init__(**kwargs)

@defaults_from_attrs("client", "bucket_name", "object_name", "file_path")
def run(self, client: Minio, bucket_name: str, object_name: str, file_path: str):
def run(
self, client: Minio, bucket_name: str, object_name: str, file_path: str
) -> str:

# get object as file
client.fget_object(
Expand All @@ -276,3 +283,5 @@ def run(self, client: Minio, bucket_name: str, object_name: str, file_path: str)
bucket_name,
file_path,
)

return file_path

0 comments on commit 60b2ea6

Please sign in to comment.