Skip to main content

腾讯云对象存储与 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: 预签名下载链接,或空字符串

Metadata

Release files for dagster-qcloud-cos 0.27.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dagster-qcloud-cos 0.27.4
File Size Uploaded Provenance Actions
dagster_qcloud_cos-0.27.4.tar.gz 7.0 kB Without provenance Details for dagster_qcloud_cos-0.27.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dagster-qcloud-cos 0.27.4
File Interpreter ABI Platform Actions
dagster_qcloud_cos-0.27.4-py3-none-any.whl Python 3 none any Details for dagster_qcloud_cos-0.27.4-py3-none-any.whl

Total release size: 12.3 kB

Release files / dagster_qcloud_cos-0.27.4.tar.gz

Download URL dagster_qcloud_cos-0.27.4.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
63ef6183429fd273df2f5b5ca937fc3d30eabc962e4d4840453521580813abc8
BLAKE2b-256 checksum
How to use checksums
157d8dcd58dd786ebba7a5da7aa91d6619c7995b228c75d8ad44750262d93df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.30

Release files / dagster_qcloud_cos-0.27.4-py3-none-any.whl

Download URL dagster_qcloud_cos-0.27.4-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75d12c798df7689d015c33191d8a2c55a0d429f45a3ce5f5dd09330795f2dc5d
BLAKE2b-256 checksum
How to use checksums
ca8e98952fec0d9d3214bb9ff9abb2299c6c2c63572ccc3d30a6389f2ff93834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.30

Security for dagster-qcloud-cos 0.27.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page