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 more information to wait-for-publish #11713

Merged
merged 7 commits into from
Mar 15, 2023

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Feb 14, 2023

This reworks the console output when waiting for a publish to be available:

  • Shows a "Published" status to try to make it clear that the publish is complete, and that Cargo is moving to a separate phase.
  • Removes the repeated status bars and updating messages, and uses a single progress bar to track the publish.
  • Provides more of a description of why Cargo is waiting to try to make it clearer what is happening.
  • Provides more information when a timeout happens to try to explain what might be happening.
  • Shows a "Completed" message at the end to let the user know that everything is complete.

Comparing the output:

Before (with git):

    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.4.27 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Updating crates.io index
     Waiting on `delay` to propagate to crates.io index (ctrl-c to wait asynchronously)
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index

Before (with sparse):

    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Updating crates.io index
     Waiting on `delay` to propagate to crates.io index (ctrl-c to wait asynchronously)
       Fetch [=============================>   ] 36 complete; 1 pending

New (git or sparse):

    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Uploaded delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
note: Waiting for `delay@0.0.2` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly.
     Waiting [===>                       ] 11/60
   Published delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo) has been successfully published to registry `crates-io`

(Note: In the last two cases the progress bar disappears when it is done, I have just included it here to illustrate.)

Fixes #11304

@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-console-output Area: Terminal output, colors, progress bar, etc. A-directory-source Area: directory sources (vendoring) A-git Area: anything dealing with git A-interacts-with-crates.io Area: interaction with registries A-local-registry-source Area: local registry sources (vendoring) A-overrides Area: general issues with overriding dependencies (patch, replace, paths) A-registries Area: registries A-source-replacement Area: [source] replacement A-sparse-registry Area: http sparse registries A-testing-cargo-itself Area: cargo's tests S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2023
@ehuss ehuss force-pushed the publish-waiting-extra-info branch from ec2a69a to a814076 Compare February 14, 2023 21:23
Comment on lines +47 to +48
/// If quiet, the source should not display any progress or status messages.
fn set_quiet(&mut self, quiet: bool);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, don't we cache sources generally (and the "wait" logic has to workaround that)? I feel like mutating a cached item like this is pretty brittle (in an already brittle system) and I'd hope we can find a way to avoid making it worse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow. Sources are inherently mutable. I'm not sure I would say they are "cached" so much as they are lazily created as needed and held in the SourceMap. But by their nature they are accessed from the map and mutated as needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

As for the caching / lazy loading, I don't remember the details but I do remember running into a lot of problems implementing this because I was getting stale state due to caches that said "everything is loaded, no reason to talk to the server again".

But by their nature they are accessed from the map and mutated as needed.

From my quick glance, they are mutated as-needed in that you invalidate their cache and they reload. I didn't see any other real "state" to them that could leak from one operation to another. That is what I'm concerned about. As I said, I ran into a lot of problems with cargo assuming everything was only done once because commands are transient but when a command needed to do things multiple times, they broke. While I am not refreshed on all the details to map out whether its actually safe or not, this feels like one of those things that could easily cause people problems in the future.

src/cargo/ops/registry.rs Outdated Show resolved Hide resolved
Comment on lines 459 to 465
config.shell().note(format!(
"Waiting up to {max} seconds for `{short_pkg_description}` to be available at {source_description}.\n\
You may press ctrl-c to skip waiting; the crate should be available shortly."
))?;
Copy link
Contributor

Choose a reason for hiding this comment

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

When looking at the output, I felt this note was too busy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have any suggestions to improve it? I don't see any way to shorten the first sentence any more than it is, and I think it is important to inform the user what Cargo is about to do. The second sentence I think is pretty awkward, but I couldn't come up with anything much better. I think the previous text of (ctrl-c to wait asynchronously) was short and to-the-point, but not very clear to me on what that meant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dropped the "up to 60 seconds" part to de-clutter since it didn't seem too terribly important for the user to know the exact value.

@epage
Copy link
Contributor

epage commented Feb 14, 2023

Thanks for going in and improving this!

src/cargo/ops/registry.rs Outdated Show resolved Hide resolved
@ehuss ehuss force-pushed the publish-waiting-extra-info branch from a814076 to f7613ec Compare February 15, 2023 17:53
@weihanglo
Copy link
Member

Note that this effectively resolves #11304.

@ehuss
Copy link
Contributor Author

ehuss commented Mar 14, 2023

@epage Did you have any other questions or ideas for improvements here? I'd like to get this in 1.70 with plenty of time for testing.

@epage
Copy link
Contributor

epage commented Mar 15, 2023

@bors r+

Sorry, seemed to either lose track of approving this or what I was blocking it on. I might have some nitpicks with it still but there is enough value being added that its not worth holding it up over them

@bors
Copy link
Contributor

bors commented Mar 15, 2023

📌 Commit fade07e has been approved by epage

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 15, 2023
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 15, 2023
@bors
Copy link
Contributor

bors commented Mar 15, 2023

⌛ Testing commit fade07e with merge 1658330...

bors added a commit that referenced this pull request Mar 15, 2023
Add more information to wait-for-publish

This reworks the console output when waiting for a publish to be available:

* Shows a "Published" status to try to make it clear that the publish is complete, and that Cargo is moving to a separate phase.
* Removes the repeated status bars and updating messages, and uses a single progress bar to track the publish.
* Provides more of a description of why Cargo is waiting to try to make it clearer what is happening.
* Provides more information when a timeout happens to try to explain what might be happening.
* Shows a "Completed" message at the end to let the user know that everything is complete.

Comparing the output:

Before (with git):

```
    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.4.27 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Updating crates.io index
     Waiting on `delay` to propagate to crates.io index (ctrl-c to wait asynchronously)
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
    Updating crates.io index
```

Before (with sparse):

```
    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Updating crates.io index
     Waiting on `delay` to propagate to crates.io index (ctrl-c to wait asynchronously)
       Fetch [=============================>   ] 36 complete; 1 pending
```

New (git or sparse):

```
    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Uploaded delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
note: Waiting for `delay@0.0.2` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly.
     Waiting [===>                       ] 11/60
   Published delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo) has been successfully published to registry `crates-io`
```

(Note: In the last two cases the progress bar disappears when it is done, I have just included it here to illustrate.)

Fixes #11304
@bors
Copy link
Contributor

bors commented Mar 15, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 15, 2023
ehuss added 7 commits March 15, 2023 08:15
This adds the ability to silence Source status messages and progress bars.
This is intended to be used with the publish "wait for available"
system, which causes sources to repeatedly update which ends up spamming
the terminal.
This level of detail isn't particularly important to the user and
just clutters up the output.
@ehuss ehuss force-pushed the publish-waiting-extra-info branch from fade07e to 3c295cf Compare March 15, 2023 15:50
@epage
Copy link
Contributor

epage commented Mar 15, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Mar 15, 2023

📌 Commit 3c295cf has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 15, 2023
@bors
Copy link
Contributor

bors commented Mar 15, 2023

⌛ Testing commit 3c295cf with merge 2b901be...

@bors
Copy link
Contributor

bors commented Mar 15, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 2b901be to master...

@bors bors merged commit 2b901be into rust-lang:master Mar 15, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2023
Update cargo

11 commits in 4a3c588b1f0a8e2dc8dd8789dbf3b6a71b02ed49..15d090969743630bff549a1b068bcaa8174e5ee3
2023-03-14 14:05:36 +0000 to 2023-03-21 17:54:28 +0000
- docs(contrib): Move higher level resolver docs into doc comments (rust-lang/cargo#11870)
- docs(contrib): Pull impl info out of architecture (rust-lang/cargo#11869)
- Update curl-sys (rust-lang/cargo#11871)
- Poll loop fixes (rust-lang/cargo#11624)
- clippy: warn `disallowed_methods` for `std::env::var` and friends (rust-lang/cargo#11828)
- Add --ignore-rust-version flag to cargo install (rust-lang/cargo#11859)
- Handle case mismatches when looking up env vars in the Config snapshot (rust-lang/cargo#11824)
- align semantics of generated vcs ignore files (rust-lang/cargo#11855)
- Add more information to wait-for-publish (rust-lang/cargo#11713)
- docs: Address warnings (rust-lang/cargo#11856)
- docs(contrib): Create a file overview in the nightly docs (rust-lang/cargo#11850)
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Mar 22, 2023
Update cargo

11 commits in 4a3c588b1f0a8e2dc8dd8789dbf3b6a71b02ed49..15d090969743630bff549a1b068bcaa8174e5ee3
2023-03-14 14:05:36 +0000 to 2023-03-21 17:54:28 +0000
- docs(contrib): Move higher level resolver docs into doc comments (rust-lang/cargo#11870)
- docs(contrib): Pull impl info out of architecture (rust-lang/cargo#11869)
- Update curl-sys (rust-lang/cargo#11871)
- Poll loop fixes (rust-lang/cargo#11624)
- clippy: warn `disallowed_methods` for `std::env::var` and friends (rust-lang/cargo#11828)
- Add --ignore-rust-version flag to cargo install (rust-lang/cargo#11859)
- Handle case mismatches when looking up env vars in the Config snapshot (rust-lang/cargo#11824)
- align semantics of generated vcs ignore files (rust-lang/cargo#11855)
- Add more information to wait-for-publish (rust-lang/cargo#11713)
- docs: Address warnings (rust-lang/cargo#11856)
- docs(contrib): Create a file overview in the nightly docs (rust-lang/cargo#11850)
@ehuss ehuss added this to the 1.70.0 milestone Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. A-directory-source Area: directory sources (vendoring) A-git Area: anything dealing with git A-interacts-with-crates.io Area: interaction with registries A-local-registry-source Area: local registry sources (vendoring) A-overrides Area: general issues with overriding dependencies (patch, replace, paths) A-registries Area: registries A-source-replacement Area: [source] replacement A-sparse-registry Area: http sparse registries A-testing-cargo-itself Area: cargo's tests S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra "Updating index" messages after publishing a crate
5 participants