FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-python/patches/kaggle_datasets.py at master · HpcDataLab/docker-python · GitHub
HpcDataLab
/
docker-python
Public
forked from
Kaggle/docker-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-python
/
patches
/
kaggle_datasets.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (20 loc) · 826 Bytes
Breadcrumbs
docker-python
/
patches
/
kaggle_datasets.py
Copy path
File metadata and controls
25 lines (20 loc) · 826 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import
os
from
kaggle_web_client
import
KaggleWebClient
_KAGGLE_TPU_NAME_ENV_VAR_NAME
=
'TPU_NAME'
class
KaggleDatasets
:
GET_GCS_PATH_ENDPOINT
=
'/requests/CopyDatasetVersionToKnownGcsBucketRequest'
TIMEOUT_SECS
=
600
# Integration types for GCS
AUTO_ML
=
1
TPU
=
2
def
__init__
(
self
):
self
.
web_client
=
KaggleWebClient
()
self
.
has_tpu
=
os
.
getenv
(
_KAGGLE_TPU_NAME_ENV_VAR_NAME
)
is
not
None
def
get_gcs_path
(
self
,
dataset_dir
:
str
=
None
)
->
str
:
integration_type
=
self
.
TPU
if
self
.
has_tpu
else
self
.
AUTO_ML
data
=
{
'MountSlug'
:
dataset_dir
,
'IntegrationType'
:
integration_type
,
}
result
=
self
.
web_client
.
make_post_request
(
data
,
self
.
GET_GCS_PATH_ENDPOINT
,
self
.
TIMEOUT_SECS
)
return
result
[
'destinationBucket'
]
Back
|
FazBrowse Home
|
New Git URL