-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make CPU's float #91
Conversation
@@ -35,6 +35,7 @@ | |||
use Utopia\Http\Route; | |||
use Utopia\Http\Validator\Assoc; | |||
use Utopia\Http\Validator\Boolean; | |||
use Utopia\Http\Validator\FloatValidator; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
This PR makes CPU's float so they work correctly with variable runtimes