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

Add support for uploading/downloading sandboxes #110

Closed
wants to merge 10 commits into from

Conversation

chrisburr
Copy link
Member

from pathlib import Path
from diracx.client.aio import DiracClient
import diracx.api

async with DiracClient() as client:
    pfn = await diracx.api.jobs.create_sandbox(client, [Path("/tmp/recompress-part1.txt"), Path("/tmp/recompress-meta-part2.zip")])
    print(pfn)

destination = Path("/tmp/test")
async with DiracClient() as client:
    await diracx.api.jobs.download_sandbox(client, pfn, destination)
assert (destination / "recompress-part1.txt").is_file()
assert (destination / "recompress-meta-part2.zip").is_file()

@chrisburr chrisburr force-pushed the sandbox-support branch 2 times, most recently from 5912303 to 9df171a Compare September 27, 2023 10:03
if res.url:
logger.debug("Uploading sandbox for %s", res.pfn)
files = {"file": ("file", tar_fh)}
response = httpx.post(res.url, data=res.fields, files=files)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await

@chrisburr chrisburr force-pushed the sandbox-support branch 2 times, most recently from 0197494 to cca9b80 Compare October 2, 2023 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants