在 Google 云存储中创建的动态子文件夹
Dynamic Subfolders created in Google Cloud Storage
1) 我想通过 gsutil 或 python 在 Google 云存储中创建动态文件夹和子文件夹结构。每当用户在 Web 门户中创建 job_id 时,它应该创建以下文件夹结构。
例如,
**$BUCKET/CV/$JOB_ID
$BUCKET/JD/$JOB_ID
$BUCKET/Report/$JOB_ID
2) 我可以在 python NLP 脚本中使用这些动态文件路径来处理算法吗?
使用您拥有的代码,base,您可以执行如下操作:
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destination_blob_name, api_parameter):
"""Uploads a file to the bucket."""
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob("{}/".format(api_parameter) + destination_blob_name)
其中 api_parameter
是您提到的 API 中的查询参数。
1) 我想通过 gsutil 或 python 在 Google 云存储中创建动态文件夹和子文件夹结构。每当用户在 Web 门户中创建 job_id 时,它应该创建以下文件夹结构。
例如,
**$BUCKET/CV/$JOB_ID
$BUCKET/JD/$JOB_ID
$BUCKET/Report/$JOB_ID
2) 我可以在 python NLP 脚本中使用这些动态文件路径来处理算法吗?
使用您拥有的代码,base,您可以执行如下操作:
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destination_blob_name, api_parameter):
"""Uploads a file to the bucket."""
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob("{}/".format(api_parameter) + destination_blob_name)
其中 api_parameter
是您提到的 API 中的查询参数。