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

Make CPU's float #91

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Make CPU's float #91

merged 1 commit into from
Aug 6, 2024

Conversation

PineappleIOnic
Copy link
Contributor

This PR makes CPU's float so they work correctly with variable runtimes

@@ -35,6 +35,7 @@
use Utopia\Http\Route;
use Utopia\Http\Validator\Assoc;
use Utopia\Http\Validator\Boolean;
use Utopia\Http\Validator\FloatValidator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename it to Float? It's already in namespace of Validator.

Copy link
Contributor

Choose a reason for hiding this comment

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

its actually called FloatValidator in the http library
https://github.com/utopia-php/http/blob/master/src/Http/Validator/FloatValidator.php

We need to fix it there.

For now we can do use Utopia\Http\Validator\FloatValidator as Float;

Copy link
Member

Choose a reason for hiding this comment

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

We can't do either (I wanted to do this previously 😅) Class names are case-insensitive in PHP, and classes named 'int', 'string', 'float', 'bool', 'true', 'false', or 'null' are forbidden

->param('memory', 512, new Integer(), 'Container RAM memory.', true)
->param('version', 'v3', new WhiteList(['v2', 'v3']), 'Runtime Open Runtime version.', true)
->param('runtimeEntrypoint', '', new Text(1024, 0), 'Commands to run when creating a container. Maximum of 100 commands are allowed, each 1024 characters long.', true)
->inject('activeRuntimes')
->inject('response')
->inject('log')
->action(
function (string $runtimeId, ?string $payload, string $path, string $method, array $headers, int $timeout, string $image, string $source, string $entrypoint, array $variables, int $cpus, int $memory, string $version, string $runtimeEntrypoint, Table $activeRuntimes, Response $response, Log $log) {
function (string $runtimeId, ?string $payload, string $path, string $method, array $headers, int $timeout, string $image, string $source, string $entrypoint, array $variables, float $cpus, int $memory, string $version, string $runtimeEntrypoint, Table $activeRuntimes, Response $response, Log $log) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We use $cpus in setCpu(). that is https://github.com/utopia-php/orchestration/blob/main/src/Orchestration/Orchestration.php#L217

Notice it accepts int. We need to change orchestration library to support float too

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeap we updated it 👍 Release 0.10.1 of it

@christyjacob4 christyjacob4 merged commit 2401334 into 0.5.x Aug 6, 2024
3 checks passed
@christyjacob4 christyjacob4 deleted the 0.5.x-cpu-floats branch August 6, 2024 10: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.

4 participants