Skip to content

Run daemon without registry index watcher in local docker #872

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

Merged
merged 7 commits into from
Jul 5, 2020

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Jul 1, 2020

Allows running all components of the daemon with the registry index watcher disabled in testing environments. This means that you can manually insert crates into the queue with docker-compose run --rm web queue add serde 1.0.106 and the daemon will pick them up and build them like production. It also means the github_updater and release_activity_updater will run locally.

@pietroalbini
Copy link
Member

This will break the metrics for builds. What about adding a --disable-registry-watcher flag to the daemon to avoid spawning that thread?

@Nemo157
Copy link
Member Author

Nemo157 commented Jul 1, 2020

Hmm, yes, I forgot the metrics were hidden in some globals. Guess we really need to do the internal refactoring to make the queue builder thread more independent before being able to run it in a separate process.

Yeah, I'll change it up to just disable that component tomorrow.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

This will break the metrics for builds.

Only when developing locally, right? I'm ok with local metrics being a little iffy if it means we can split apart the queue builder.

Other than that these changes look great.

@jyn514
Copy link
Member

jyn514 commented Jul 1, 2020

Also even if the docker stuff doesn't make it in because of metrics I'd love to have the refactor in so the queue is separate from the daemon.

@jyn514 jyn514 added A-builds Area: Building the documentation for a crate C-technical-debt Category: This makes the code harder to read and modify, but has no impact on end users P-low Low priority issues S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Jul 3, 2020
@Nemo157 Nemo157 force-pushed the cli-build-queue branch from 19545c3 to 5719933 Compare July 4, 2020 11:55
@Nemo157 Nemo157 changed the title Add ability to run an independent queue builder Run daemon without registry index watcher in local docker Jul 4, 2020
@Nemo157
Copy link
Member Author

Nemo157 commented Jul 4, 2020

Since we're now running the github updater locally, where we're likely to not have given it an access token, I've refactored it completely to work better (using a single reqwest client kept around for connection pooling, and serde for parsing the responses) and deal with rate limiting better.

@Nemo157 Nemo157 force-pushed the cli-build-queue branch from 3db8cc9 to 0605d24 Compare July 4, 2020 17:49
ctx.config()?,
ctx.pool()?,
ctx.build_queue()?,
!disable_registry_watcher,
Copy link
Member

Choose a reason for hiding this comment

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

Double negatives are confusing. Can we change this to --registry-watcher and --no-registry-watcher then have it true by default?

Copy link
Member

Choose a reason for hiding this comment

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

I think --disable-registry-watcher would be a fine flag, disable makes more sense than no to me

Copy link
Member

Choose a reason for hiding this comment

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

But then you get double negatives like we have here, which make it harder to reason about the logic. I'm sure clap has an option to renamed --no-registry-watcher to --disable-registry-watcher if you want to keep the same CLI (or just add an alias).

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see any easy way to do a --flag --no-flag pair with clap or structopt.

Copy link
Member

Choose a reason for hiding this comment

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

We could use a custom FromStr implementation: https://docs.rs/structopt/0.3.15/structopt/#custom-string-parsers

But that's getting a little more complicated, I'm ok if you want to leave it as-is.

}
})
.unwrap();
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe split this whole if body into a separate function?

@Nemo157 Nemo157 force-pushed the cli-build-queue branch 2 times, most recently from 0f9c409 to f84416c Compare July 5, 2020 09:10
@Nemo157 Nemo157 force-pushed the cli-build-queue branch from f84416c to 678906b Compare July 5, 2020 09:11
@Nemo157 Nemo157 force-pushed the cli-build-queue branch from 17c3144 to 71bc5f0 Compare July 5, 2020 09:30
@jyn514 jyn514 merged commit 914e365 into rust-lang:master Jul 5, 2020
@Nemo157 Nemo157 deleted the cli-build-queue branch June 24, 2021 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-technical-debt Category: This makes the code harder to read and modify, but has no impact on end users P-low Low priority issues S-waiting-on-author Status: This PR is incomplete or needs to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants