Skip to content

Comments

feat(--cpus): add support for --cpus flag#136

Open
PawanKumarA wants to merge 1 commit intolavie:masterfrom
PawanKumarA:master
Open

feat(--cpus): add support for --cpus flag#136
PawanKumarA wants to merge 1 commit intolavie:masterfrom
PawanKumarA:master

Conversation

@PawanKumarA
Copy link

This commit adds support for the --cpus flag, allowing users to reproduce container CPU limits. The docker inspect command outputs this value as NanoCpus, an integer. However, the docker run command expects a floating-point number for the --cpus flag.

This implementation correctly parses the NanoCpus integer and converts it to a floating-point number. For example, a value of 1,000,000,000 NanoCpus will be correctly represented as 1.0 in the generated docker run command.

This commit adds support for the --cpus flag, allowing users to reproduce container CPU limits. The `docker inspect` command outputs this value as `NanoCpus`, an integer. However, the `docker run` command expects a floating-point number for the `--cpus` flag.

This implementation correctly parses the `NanoCpus` integer and converts it to a floating-point number. For example, a value of 1,000,000,000 NanoCpus will be correctly represented as 1.0 in the generated `docker run` command.
@lavie
Copy link
Owner

lavie commented Aug 25, 2025

Thank you for your contribution.
If you could please add test coverage in https://github.com/lavie/runlike/blob/master/test_runlike.py I will be happy to merge your PR.

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