Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] add retry and cache for credential of OdpsDataset #45

Merged
merged 6 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ grpcio-tools<1.63.0
pandas
pyfg @ https://tzrec.oss-cn-beijing.aliyuncs.com/third_party/pyfg-0.3.7-cp311-cp311-linux_x86_64.whl ; python_version=="3.11"
pyfg @ https://tzrec.oss-cn-beijing.aliyuncs.com/third_party/pyfg-0.3.7-cp310-cp310-linux_x86_64.whl ; python_version=="3.10"
pyodps>=0.12.0
scikit-learn
tensorboard
torch==2.5.0
Expand Down
8 changes: 4 additions & 4 deletions tzrec/datasets/odps_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import pyarrow as pa
import urllib3
from alibabacloud_credentials import providers
from alibabacloud_credentials.client import Client as CredClient
from odps import ODPS
from odps.accounts import AliyunAccount, BaseAccount, CredentialProviderAccount
from odps.apis.storage_api import (
Expand Down Expand Up @@ -109,10 +109,10 @@ def _create_odps_account() -> Tuple[BaseAccount, str]:
)
account = AliyunAccount(account_id, account_key)
elif "ALIBABA_CLOUD_CREDENTIALS_URI" in os.environ:
p = providers.DefaultCredentialsProvider()
credentials_client = CredClient()
# prevent too much request to credential server after forked
p.get_credentials().get_credential()
account = CredentialProviderAccount(p)
credentials_client.get_credential()
account = CredentialProviderAccount(credentials_client)
try:
odps_endpoint = os.environ["ODPS_ENDPOINT"]
except KeyError as err:
Expand Down
2 changes: 1 addition & 1 deletion tzrec/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.6.4"
__version__ = "0.6.5"