Skip to main content

腾讯云对象存储与 Dagster 集成

Project description

腾讯云对象存储与 Dagster 集成

该 Dagster 集成是为了更便捷的调用腾讯云对象存储,集成提供了一个 Dagster Resource,和一个 Op 。

安装

要安装库,请使用 pip 。

pip install dagster-qcloud-cos -U

Resource

QcloudCosResource

该资源返回一个 CosS3Client 类,该类是腾讯云官方 Python SDK 的类.

可以查看 https://cloud.tencent.com/document/product/436/12269 了解使用方法。

OP

使用 InitCosOperations 类可以为不同的 resource_key 搭建一套各自的 op

from dagster_qcloud_cos import InitCosOperations, QcloudCosResource
from dagster import job, Definitions

# 定义一套依赖于 bucket_a 资源的 op
# 该类会创建一套 required_resource_keys={"bucket_a"} 的 op
bucket_a_ops = InitCosOperations(resource_key="bucket_a")

@job
def upload_file():
    etag, pre_signed_url = bucket_a_ops.op_upload_file()    
    ...(etag, pre_signed_url)

defs = Definitions(
    jobs=[upload_file],
    resources={"bucket_a": QcloudCosResource(BucketId="bucket_a")}
)

或者直接使用预置的 op ,默认操作会使用 resource_key = 'qcloud_cos' 的资源。

from dagster_qcloud_cos import cos_op, QcloudCosResource
from dagster import job, Definitions

@job
def upload_file():
    etag, pre_signed_url = cos_op.op_upload_file()    
    ...(etag, pre_signed_url)

defs = Definitions(
    jobs=[upload_file],
    resources={"qcloud_cos": QcloudCosResource(BucketId="bucket_a")}
)

op_upload_file

上传 5G 大小以内的文件并获取预签名的临时链接

输入:
  • key: str, 上传文件KEY
  • file: bytes, 文件字节数据
  • expired: int, 预签名下载链接的过期时间,0 为不获取,默认为 0
  • bucket: str, bucket_id,默认为资源设置的bucket_id
输出:
  • etag
  • presigned_url: 预签名下载链接,或空字符串

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dagster_qcloud_cos-0.1.5.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dagster_qcloud_cos-0.1.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file dagster_qcloud_cos-0.1.5.tar.gz.

File metadata

  • Download URL: dagster_qcloud_cos-0.1.5.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.30

File hashes

Hashes for dagster_qcloud_cos-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4f23383f14d18869a79ecbe039bd3b9faa565ab430b2e6634fa5056dd9230034
MD5 bfe8711c251d7c2bb10721677b657e17
BLAKE2b-256 cac7499eef6879f7dda6c2b25f952864c64d1c0078dc8d559e353e6a984b89f8

See more details on using hashes here.

File details

Details for the file dagster_qcloud_cos-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for dagster_qcloud_cos-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 137b0fd6b405c68076fdacd87d55b7840859fb2e27a4f725813dba5eb01499a2
MD5 eed7e7030f6abc3b5c843f3531e3b234
BLAKE2b-256 10be50ccf33d284d4256f23a359d04cad1c57e25186a2292acd429b8e8b12d3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page