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

rsc: Resolve Blobs on request #1502

Merged
merged 5 commits into from
Jan 25, 2024
Merged

rsc: Resolve Blobs on request #1502

merged 5 commits into from
Jan 25, 2024

Conversation

V-FEXrt
Copy link
Contributor

@V-FEXrt V-FEXrt commented Jan 16, 2024

Blobs returned to the client via a matching jobs now resolve and return the URL where that blob can be downloaded from.

Example:

{
    "cputime": 1.0,
    "ibytes": 100000,
    "memory": 1000,
    "obytes": 1000,
    "output_dirs": [],
    "output_files": [
        {
            "blob": {
                "id": "4ad74b40-4a3f-4464-a488-77f6297c8121",
                "url": "file:///foo/bar/remote_cache_local_store/57KcxXl4PxMyjPcZIRJvDw=="
            },
            "mode": 0,
            "path": "foo"
        }
    ],
    "output_symlinks": [],
    "runtime": 1.0,
    "status": 0,
    "stderr_blob": {
        "id": "5bfb8a97-c244-4241-a091-5aa3388c20eb",
        "url": "file:///foo/bar/remote_cache_local_store/X1MS-Semg55oqRF3U9LAYA=="
    },
    "stdout_blob": {
        "id": "4ad74b40-4a3f-4464-a488-77f6297c8121",
        "url": "file:///foo/bar/remote_cache_local_store/57KcxXl4PxMyjPcZIRJvDw=="
    },
    "type": "Match"
}

@V-FEXrt V-FEXrt requested a review from colinschmidt January 16, 2024 18:24
local_store: Option<String>,
// Maps databse store uuid -> dyn blob::DebugBlobStore
// that represent said store.
async fn activate_stores(
Copy link
Contributor

Choose a reason for hiding this comment

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

This name is confusing. Should it just be called active_stores? Activate to me implies its going to have a side effect but its just collecting data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This kind of ties in to the question below. Its not quite just collecting data, it also transforms the database model into the object responsible for doing things. The reason for "activate" was because we had to upgrade the data to a service to make it usable. Otherwise it would've just been called fetch or get.

One thing that may be important to note, this function will also be where other non-local stores are constructed/upgraded in the future

for store in stores.into_iter() {
active_stores.insert(
store.id,
Arc::new(blob::LocalBlobStore { root: store.root }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this not just Arc::new(store)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LocalBloStore is a different type/"service provider"

The LocalBlobStore in the database is just tracking data needed to construct the "runtime" LocalBlobStore which actually implements the api/trait to upload/resolve/delete a blob

rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved
rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved
rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved
rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved
rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved
rust/rsc/src/rsc/read_job.rs Outdated Show resolved Hide resolved

let stderr_blob = match resolve_blob(matching_job.stderr_blob_id, txn, &blob_stores).await {
Err(err) => {
tracing::error! {%err, "Failed to resolve stderr blob. Resoving job as a cache miss."};
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: You made a typo in "Resolving" in all of these error messages.

Copy link
Contributor

@colinschmidt colinschmidt left a comment

Choose a reason for hiding this comment

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

LGTM

@V-FEXrt V-FEXrt merged commit 62f8bc4 into master Jan 25, 2024
12 checks passed
@V-FEXrt V-FEXrt deleted the rsc-blob-resolution branch January 25, 2024 20:01
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