-
Notifications
You must be signed in to change notification settings - Fork 0
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
Expose analyze endpoint #376
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #376 +/- ##
==========================================
+ Coverage 93.46% 93.63% +0.17%
==========================================
Files 62 62
Lines 2279 2372 +93
==========================================
+ Hits 2130 2221 +91
- Misses 149 151 +2 ☔ View full report in Codecov by Sentry. |
# we get the task definition as a native dict to more easily translate | ||
# the sub-objects into RMS models |
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 get the task definition as a native dict to more easily translate | |
# the sub-objects into RMS models | |
# Task definition is retrieved as a native dictionary to more easily translate | |
# the subobjects into RMS models |
Avoid "we"--even in comments.
) -> AnalyzeResponse: | ||
"""Compare resource requirements against available compute resources.""" | ||
if requirements is None: | ||
raise ClientError(f"requirements can't be None.") |
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.
raise ClientError(f"requirements can't be None.") | |
raise ClientError(f"Requirements can't be 'None'.") |
) | ||
number_accessible_assignable_and_matching: int = Field( | ||
..., | ||
description='Number of workers matching hardware, platform, application, custom requirements, assignment and permissions', |
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.
description='Number of workers matching hardware, platform, application, custom requirements, assignment and permissions', | |
description='Number of workers matching hardware, platform, application, custom requirements, assignment, and permissions', |
|
||
class AnalyzeHpcResources(BaseModel): | ||
num_cores_per_node: Optional[int] = Field(None, title='Num Cores Per Node') | ||
num_gpus_per_node: Optional[int] = Field(None, title='Num Gpus Per Node') |
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.
num_gpus_per_node: Optional[int] = Field(None, title='Num Gpus Per Node') | |
num_gpus_per_node: Optional[int] = Field(None, title='Num Gpus Per Node') |
Do the descriptions that appear in "Field" show in the documentation? If so, they should be written out in plain English without using abbreviations. They should also conclude with periods. Later "Field" descriptions are formatted in the way that I expect.
src/ansys/hps/client/rms/models.py
Outdated
) | ||
host_id: Optional[str] = Field( | ||
None, description="Static, hardware and configuration-based UUID.", title="Host Id" | ||
None, description='Static, hardware and configuration-based UUID.', title='Host Id' |
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.
None, description='Static, hardware and configuration-based UUID.', title='Host Id' | |
None, description='Static hardware and configuration-based UUID.', title='Host Id' |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
exclusive: Optional[bool] = Field( | ||
None, description="To not share nodes with other running jobs.", title="Exclusive" | ||
None, description='To not share nodes with other running jobs.', title='Exclusive' |
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.
None, description='To not share nodes with other running jobs.', title='Exclusive' | |
None, description='Whether to not share nodes with other running jobs.', title='Exclusive' |
src/ansys/hps/client/rms/models.py
Outdated
debug: Optional[bool] = Field( | ||
False, description="Enable additional debugging of the backend", title="Debug" | ||
False, description='Enable additional debugging of the backend', title='Debug' |
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.
False, description='Enable additional debugging of the backend', title='Debug' | |
False, description='Whether to enable additional debugging of the backend', title='Debug' |
src/ansys/hps/client/rms/models.py
Outdated
description="Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.", | ||
title="Target Resource Kind", | ||
'job', | ||
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.', |
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.
Still using "REP" here?
src/ansys/hps/client/rms/models.py
Outdated
description="Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.", | ||
title="Target Resource Kind", | ||
'job', | ||
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.', |
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.
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.', | |
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment``, and ``statefulset``.', |
We recommend alphabetizing the options, unless there is a reason not to. There are other occurrences, but I won't repeat this suggestion.
src/ansys/hps/client/rms/models.py
Outdated
description="Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.", | ||
title="Target Resource Kind", | ||
'job', | ||
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.', |
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.
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment`` and ``statefulset``.', | |
description='Kubernetes resource kind that the REP scaler should target. Options are ``job``, ``deployment``, and ``statefulset``.', |
src/ansys/hps/client/rms/models.py
Outdated
debug: Optional[bool] = Field( | ||
False, description="Enable additional debugging of the backend", title="Debug" | ||
False, description='Enable additional debugging of the backend', title='Debug' |
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.
False, description='Enable additional debugging of the backend', title='Debug' | |
False, description='Whether to enable additional debugging of the backend', title='Debug' |
) | ||
|
||
|
||
class LocalBackend(BaseModel): | ||
plugin_name: Literal["local"] = Field(..., title="Plugin Name") | ||
plugin_name: Literal['local'] = Field(..., title='Plugin Name') |
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.
plugin_name: Literal['local'] = Field(..., title='Plugin Name') | |
plugin_name: Literal['local'] = Field(..., title='Plugin name.') |
) | ||
|
||
|
||
class Machine(BaseModel): | ||
name: str = Field(..., description="Name of the machine", title="Name") | ||
num_cores: int = Field(..., description="Number of cores available", title="Num Cores") | ||
name: str = Field(..., description='Name of the machine', title='Name') |
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.
These descriptions don't conclude with a period.
src/ansys/hps/client/rms/models.py
Outdated
title='Scheduler Type', | ||
) | ||
enable_api: Optional[bool] = Field( | ||
False, description='Enable to use the scheduler Rest API feature', title='Enable Api' |
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.
False, description='Enable to use the scheduler Rest API feature', title='Enable Api' | |
False, description='Whether to use the scheduler REST API feature.', title='Enable Api' |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
base_url: Optional[str] = Field( | ||
'http://localhost:5050', description='The Rest API URL', title='Base Url' |
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.
'http://localhost:5050', description='The Rest API URL', title='Base Url' | |
'http://localhost:5050', description='REST API URL.', title='Base Url' |
src/ansys/hps/client/rms/models.py
Outdated
base_url: Optional[str] = Field( | ||
'http://localhost:5050', description='The Rest API URL', title='Base Url' | ||
) | ||
api_ver: Optional[str] = Field('v0.0.39', description='The Rest API version', title='Api Ver') |
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.
api_ver: Optional[str] = Field('v0.0.39', description='The Rest API version', title='Api Ver') | |
api_ver: Optional[str] = Field('v0.0.39', description='REST API version.', title='Api Ver') |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
exclusive_default: Optional[bool] = Field( | ||
False, | ||
description="Request the scheduler to hold the nodes exclusively for one request.", | ||
title="Exclusive Default", | ||
description='Request the scheduler to hold the nodes exclusively for one request.', |
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.
description='Request the scheduler to hold the nodes exclusively for one request.', | |
description='Whether the scheduler is to hold the nodes exclusively for one request.', |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
distributed_default: Optional[bool] = Field( | ||
True, | ||
description="Allow the scheduler to provide multiple machines to fulfill the request.", | ||
title="Distributed Default", | ||
description='Allow the scheduler to provide multiple machines to fulfill the request.', |
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.
description='Allow the scheduler to provide multiple machines to fulfill the request.', | |
description='Whether the scheduler is to provide multiple machines to fulfill the request.', |
src/ansys/hps/client/rms/models.py
Outdated
description="Use the templated versions of the scripts and write them to the working directory.", | ||
title="Use Templates", | ||
use_local_scratch: Optional[bool] = Field( | ||
False, description='To use local storage as working dir for jobs', title='Use Local Scratch' |
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.
False, description='To use local storage as working dir for jobs', title='Use Local Scratch' | |
False, description='Whether to use local storage as the working directory for jobs.', title='Use Local Scratch' |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
local_scratch_dir: Optional[str] = Field( | ||
None, | ||
description='Path to the local scratch directory to be used as jobs working dir', |
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.
description='Path to the local scratch directory to be used as jobs working dir', | |
description='Path to the local scratch directory to use as the job's working directory.', |
I realized that you may have intended plural possessive (to use as the jobs' working directory). Please change if so.
src/ansys/hps/client/rms/models.py
Outdated
discriminator="plugin_name", | ||
title="Scaling Strategy", | ||
{'debug': False, 'plugin_name': 'local'}, | ||
description='Backend to use in this compute resource set.', |
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.
description='Backend to use in this compute resource set.', | |
description='Backend to use in the compute resource set.', |
We prefer using "the" over "this" where possible.
src/ansys/hps/client/rms/models.py
Outdated
scaling_strategy: Optional[Union[MaxAvailableResourceScaling, KubernetesResourceScaling]] = ( | ||
Field( | ||
{'match_all_requirements': False, 'plugin_name': 'max_available_resource_scaling'}, | ||
description='Scaling strategy to use in this compute resource set.', |
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.
description='Scaling strategy to use in this compute resource set.', | |
description='Scaling strategy to use in the compute resource set.', |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
evaluator_auto_shutdown_time: Optional[int] = Field( | ||
20, | ||
description="Time after which to shutdown the evaluator if not running any jobs.", | ||
title="Evaluator Auto Shutdown Time", | ||
description='Time after which to shutdown the evaluator if not running any jobs.', |
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.
description='Time after which to shutdown the evaluator if not running any jobs.', | |
description='Time after which to shut down the evaluator if not running any jobs.', |
Shut down is two words as a verb and one word as a noun.
) | ||
|
||
|
||
class ComputeResourceSetsRequest(BaseModel): | ||
compute_resource_sets: List[ComputeResourceSet] = Field( | ||
..., description="Compute resource set details", title="Compute Resource Sets" | ||
..., description='Compute resource set details', title='Compute Resource Sets' |
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.
..., description='Compute resource set details', title='Compute Resource Sets' | |
..., description='Compute resource set details.', title='Compute Resource Sets' |
) | ||
|
||
|
||
class EvaluatorConfiguration(BaseModel): | ||
id: Optional[str] = Field(None, description="Unique database ID (read-only).", title="Id") | ||
id: Optional[str] = Field(None, description='Unique database ID (read-only).', title='Id') |
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 the title be ID rather than Id? We tend to always use ID.
src/ansys/hps/client/rms/models.py
Outdated
) | ||
last_modified: Optional[datetime] = Field( | ||
None, description="Last modified time", title="Last Modified" | ||
None, description='Last modified time', title='Last Modified' |
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.
None, description='Last modified time', title='Last Modified' | |
None, description='Last modified time.', title='Last Modified' |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
project_server_select: Optional[bool] = Field( | ||
True, | ||
description="Get project assignments from the server instead of using the locally set values", | ||
title="Project Server Select", | ||
description='Get project assignments from the server instead of using the locally set values', |
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.
description='Get project assignments from the server instead of using the locally set values', | |
description='Get project assignments from the server instead of using the locally set values.', |
Usually, descriptions starting with verbs are reserved for classes and methods. I'm not sure how to rewrite this so. Would this work: Projects assignments to get from the server rather than using locally set values."
src/ansys/hps/client/rms/models.py
Outdated
) | ||
project_list: Optional[List[str]] = Field( | ||
[], | ||
description="IDs of projects that the evaluator should work on, in order", | ||
title="Project List", | ||
description='IDs of projects that the evaluator should work on, in order', |
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.
description='IDs of projects that the evaluator should work on, in order', | |
description='IDs of projects that the evaluator should work on, in order.', |
src/ansys/hps/client/rms/models.py
Outdated
description="Specifies how the evaluator selects projects to work on. One of: disabled, all_active, list", | ||
title="Project Assignment Mode", | ||
'all_active', | ||
description='Specifies how the evaluator selects projects to work on. One of: disabled, all_active, list', |
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.
description='Specifies how the evaluator selects projects to work on. One of: disabled, all_active, list', | |
description='How the evaluator selects projects to work on. Options are ``disabled`` and ``all_active, list'`, |
src/ansys/hps/client/rms/models.py
Outdated
) | ||
last_modified: Optional[datetime] = Field( | ||
None, description="Last modified time", title="Last Modified" | ||
None, description='Last modified time', title='Last Modified' |
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.
None, description='Last modified time', title='Last Modified' | |
None, description='Last modified time.', title='Last Modified' |
src/ansys/hps/client/rms/models.py
Outdated
name: Optional[str] = Field( | ||
None, | ||
description="Update the name of the evaluator (updating the registration).", | ||
title="Name", | ||
description='Update the name of the evaluator (updating the registration).', |
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.
Again--the description is normally a noun. Rather than starting with a verb, can we rewrite as: "Name to update the evaluator to. Chaning the name updates the registration."
) | ||
project_assignment_mode: Optional[str] = Field( | ||
None, | ||
description="How the evaluator selects projects to work on. Options are: disabled, all_active, list.", | ||
title="Project Assignment Mode", | ||
description='How the evaluator selects projects to work on. Options are: disabled, all_active, list.', |
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.
Same suggestions as earlier.
) | ||
|
||
|
||
class EvaluatorConfigurationUpdatesResponse(BaseModel): | ||
configuration_updates: List[EvaluatorConfigurationUpdate] = Field( | ||
..., description="Configuration update details", title="Configuration Updates" | ||
..., description='Configuration update details', title='Configuration Updates' |
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.
..., description='Configuration update details', title='Configuration Updates' | |
..., description='Configuration update details.', title='Configuration Updates' |
) | ||
|
||
|
||
class EvaluatorConfigurationsResponse(BaseModel): | ||
configurations: List[EvaluatorConfiguration] = Field( | ||
..., description="Evaluator configurations", title="Configurations" | ||
..., description='Evaluator configurations', title='Configurations' |
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.
..., description='Evaluator configurations', title='Configurations' | |
..., description='Evaluator configurations.', title='Configurations' |
tests/jms/test_task_definition.py
Outdated
# we can't assume compute resources to be available, | ||
# so we just hit the endpoint |
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 assume compute resources to be available, | |
# so we just hit the endpoint | |
# Because compute resources can't be assumed to be available, | |
# hit the endpoint |
No description provided.