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

Expose analyze endpoint #376

Merged
merged 19 commits into from
Apr 23, 2024
Merged

Expose analyze endpoint #376

merged 19 commits into from
Apr 23, 2024

Conversation

FedericoNegri
Copy link
Contributor

No description provided.

@FedericoNegri FedericoNegri added the enhancement New features or code improvements label Apr 10, 2024
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 97.67442% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 93.63%. Comparing base (0dcbc15) to head (3f32af3).

Files Patch % Lines
src/ansys/hps/client/rms/api/base.py 71.42% 2 Missing ⚠️
src/ansys/hps/client/jms/api/project_api.py 91.66% 1 Missing ⚠️
src/ansys/hps/client/rms/api/rms_api.py 90.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Comment on lines 293 to 294
# we get the task definition as a native dict to more easily translate
# the sub-objects into RMS models
Copy link
Member

@PipKat PipKat Apr 10, 2024

Choose a reason for hiding this comment

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

Suggested change
# 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.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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')
Copy link
Member

@PipKat PipKat Apr 10, 2024

Choose a reason for hiding this comment

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

Suggested change
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.

)
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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
None, description='Static, hardware and configuration-based UUID.', title='Host Id'
None, description='Static hardware and configuration-based UUID.', title='Host Id'

)
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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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'

debug: Optional[bool] = Field(
False, description="Enable additional debugging of the backend", title="Debug"
False, description='Enable additional debugging of the backend', title='Debug'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
False, description='Enable additional debugging of the backend', title='Debug'
False, description='Whether to enable additional debugging of the backend', title='Debug'

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``.',
Copy link
Member

Choose a reason for hiding this comment

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

Still using "REP" here?

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``.',
Copy link
Member

@PipKat PipKat Apr 10, 2024

Choose a reason for hiding this comment

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

Suggested change
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.

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``.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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``.',

debug: Optional[bool] = Field(
False, description="Enable additional debugging of the backend", title="Debug"
False, description='Enable additional debugging of the backend', title='Debug'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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')
Copy link
Member

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.

title='Scheduler Type',
)
enable_api: Optional[bool] = Field(
False, description='Enable to use the scheduler Rest API feature', title='Enable Api'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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'

)
base_url: Optional[str] = Field(
'http://localhost:5050', description='The Rest API URL', title='Base Url'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'http://localhost:5050', description='The Rest API URL', title='Base Url'
'http://localhost:5050', description='REST API URL.', title='Base Url'

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')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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')

)
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.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.',

)
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.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.',

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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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'

)
local_scratch_dir: Optional[str] = Field(
None,
description='Path to the local scratch directory to be used as jobs working dir',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

discriminator="plugin_name",
title="Scaling Strategy",
{'debug': False, 'plugin_name': 'local'},
description='Backend to use in this compute resource set.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

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.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description='Scaling strategy to use in this compute resource set.',
description='Scaling strategy to use in the compute resource set.',

)
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.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
..., 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')
Copy link
Member

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.

)
last_modified: Optional[datetime] = Field(
None, description="Last modified time", title="Last Modified"
None, description='Last modified time', title='Last Modified'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
None, description='Last modified time', title='Last Modified'
None, description='Last modified time.', title='Last Modified'

)
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',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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."

)
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',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description='IDs of projects that the evaluator should work on, in order',
description='IDs of projects that the evaluator should work on, in order.',

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',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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'`,

)
last_modified: Optional[datetime] = Field(
None, description="Last modified time", title="Last Modified"
None, description='Last modified time', title='Last Modified'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
None, description='Last modified time', title='Last Modified'
None, description='Last modified time.', title='Last Modified'

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).',
Copy link
Member

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.',
Copy link
Member

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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
..., 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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
..., description='Evaluator configurations', title='Configurations'
..., description='Evaluator configurations.', title='Configurations'

Comment on lines 258 to 259
# we can't assume compute resources to be available,
# so we just hit the endpoint
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# 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

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 23, 2024
@FedericoNegri FedericoNegri marked this pull request as ready for review April 23, 2024 12:39
@FedericoNegri FedericoNegri merged commit 5bb88c8 into main Apr 23, 2024
21 checks passed
@FedericoNegri FedericoNegri deleted the fnegri/analyze branch April 23, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New features or code improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants