diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 787cd5a8f..092b3cdf2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,19 +4,19 @@ repos: rev: 22.3.0 hooks: - id: black - exclude: ^(ansys/hps/client/jms/resource/|ansys/hps/client/auth/resource/|ansys/hps/client/rms/models.py) + exclude: ^(src/ansys/hps/client/rms/models.py) - repo: https://github.com/pycqa/isort rev: 5.11.5 hooks: - id: isort - exclude: ^(ansys/hps/client/jms/resource/|ansys/hps/client/auth/resource/) + # exclude: ^(src/ansys/hps/client/jms/resource/|src/ansys/hps/client/auth/resource/) - repo: https://github.com/PyCQA/flake8 rev: 5.0.4 hooks: - id: flake8 - exclude: ^(ansys/hps/client/jms/resource/|ansys/hps/client/auth/resource/) + exclude: ^(src/ansys/hps/client/jms/resource/|src/ansys/hps/client/auth/resource/) - repo: https://github.com/codespell-project/codespell rev: v2.1.0 diff --git a/generate_resources.py b/generate_resources.py index 2ec98575a..7dcfbdb13 100644 --- a/generate_resources.py +++ b/generate_resources.py @@ -385,6 +385,26 @@ def get_resource_imports(resource, base_class): return imports +def camel_case_split(text: str) -> str: + words = [[text[0]]] + + for c in text[1:]: + if words[-1][-1].islower() and c.isupper(): + words.append(list(c)) + else: + words[-1].append(c) + + words = ["".join(word) for word in words] + return " ".join([w.lower() for w in words]) + + +def get_module_docstring(file_name: str) -> str: + module_name = " ".join(file_name.split("_")) + code = f'''"""Module providing the {module_name} resource.""" +''' + return code + + def get_resource_code(resource, base_class, fields, field_docs): fields_str = "" @@ -400,23 +420,25 @@ def get_resource_code(resource, base_class, fields, field_docs): init_fields_str = " **kwargs" code = f'''class {resource['class']}({base_class["name"]}): - """{resource['class']} resource. + """Provides the {camel_case_split(resource['class'])} resource. Parameters ---------- -{field_docs} +{field_docs.rstrip()} """ class Meta: schema = {resource['schema']} rest_name = "{resource['rest_name']}" - def __init__(self, + def __init__( + self, {init_fields_str} ): {fields_str} {additional_initialization} + {resource['schema']}.Meta.object_class = {resource['class']} ''' return code @@ -424,7 +446,7 @@ def __init__(self, def process_resources(subpackage, resources, base_class_path="ansys.hps.client"): - target_folder = os.path.join("ansys", "hps", "client", subpackage, "resource") + target_folder = os.path.join("src", "ansys", "hps", "client", subpackage, "resource") resources_code = {} for resource in resources: print(f"Processing resource {resource['class']}") @@ -458,7 +480,11 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.client") # we're ready to put the pieces together file_name = resource["resource_filename"] if not file_name in resources_code: - resources_code[file_name] = {"imports": [], "code": []} + resources_code[file_name] = { + "imports": [], + "code": [], + "module_docstring": get_module_docstring(file_name), + } resources_code[file_name]["imports"].extend(get_resource_imports(resource, base_class)) resources_code[file_name]["code"].append( @@ -473,6 +499,7 @@ def process_resources(subpackage, resources, base_class_path="ansys.hps.client") code = content["code"] with open(file_path, "w") as file: file.write("# autogenerated code\n") + file.write(content["module_docstring"]) file.write("\n".join(unique_imports)) file.write("\n\n") file.write("\n".join(code)) diff --git a/src/ansys/hps/client/auth/resource/user.py b/src/ansys/hps/client/auth/resource/user.py index fc4ff2d0a..1b89c70d7 100644 --- a/src/ansys/hps/client/auth/resource/user.py +++ b/src/ansys/hps/client/auth/resource/user.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the user resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object diff --git a/src/ansys/hps/client/auth/schema/user.py b/src/ansys/hps/client/auth/schema/user.py index 50f5e59c9..1adb68a99 100644 --- a/src/ansys/hps/client/auth/schema/user.py +++ b/src/ansys/hps/client/auth/schema/user.py @@ -39,9 +39,9 @@ class Meta(BaseSchema.Meta): username = fields.Str(metadata={"description": "Username."}) password = fields.Str(dump_only=True, metadata={"description": "Password."}) firstName = fields.Str( - allow_none=True, metadata={"description": "First name"}, attribute="first_name" + allow_none=True, metadata={"description": "First name."}, attribute="first_name" ) lastName = fields.Str( - allow_none=True, metadata={"description": "Last name"}, attribute="last_name" + allow_none=True, metadata={"description": "Last name."}, attribute="last_name" ) - email = fields.Str(allow_none=True, metadata={"description": "E-mail address (optional)."}) + email = fields.Str(allow_none=True, metadata={"description": "E-mail address."}) diff --git a/src/ansys/hps/client/jms/resource/algorithm.py b/src/ansys/hps/client/jms/resource/algorithm.py index 8faf56835..9f0dc2493 100644 --- a/src/ansys/hps/client/jms/resource/algorithm.py +++ b/src/ansys/hps/client/jms/resource/algorithm.py @@ -19,8 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Module providing the algorithm resource.""" + # autogenerated code +"""Module providing the algorithm resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -48,8 +49,7 @@ class Algorithm(Object): description : str, optional Description of the algorithm. data : str, optional - Generic string field to hold arbitrary algorithm configuration data. For example, - as a JSON dictionary. + Generic string field to hold arbitrary algorithm configuration data. For example, as a JSON dictionary. jobs : list[str] List of job IDs. """ diff --git a/src/ansys/hps/client/jms/resource/job.py b/src/ansys/hps/client/jms/resource/job.py index 55150c3a0..c3b826ab6 100644 --- a/src/ansys/hps/client/jms/resource/job.py +++ b/src/ansys/hps/client/jms/resource/job.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the job resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -28,7 +30,7 @@ class Job(Object): - """Provides a job resource. + """Provides the job resource. Parameters ---------- @@ -49,8 +51,7 @@ class Job(Object): job_definition_id : str ID of the linked job definition. For more information, see the :class:`JobDefinition` class. priority : int, optional - Priority for evaluating the job. The default is ``0``, which is the highest priority. - Assigning a higher value to a job makes it a lower priority. + Priority for evaluating the job. The default is ``0``, which is the highest priority. Assigning a higher value to a job makes it a lower priority. values : dict[str, any], optional Dictionary with (name,value) pairs for all parameters defined in the linked job definition. fitness : float, optional @@ -60,10 +61,9 @@ class Job(Object): note : str, optional Note for the job. creator : str, optional - Name and ID of the creator of the job. + Additional information about the creator of the job. executed_level : int, optional - Execution level of the last executed task. A value of ``-1`` indicates that no task has been - executed yet. + Execution level of the last executed task. A value of ``-1`` indicates that no task has been executed yet. elapsed_time : float Number of seconds it took the evaluators to update the job. host_ids : list, optional diff --git a/src/ansys/hps/client/jms/resource/job_definition.py b/src/ansys/hps/client/jms/resource/job_definition.py index 29b499d5f..db469bf77 100644 --- a/src/ansys/hps/client/jms/resource/job_definition.py +++ b/src/ansys/hps/client/jms/resource/job_definition.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the job definition resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -45,8 +47,7 @@ class JobDefinition(Object): name : str, optional Name of the job definition. active : bool - Whether this is the active job definition in the project where evaluators are evaluating - pending jobs. + Whether this job definition is active. client_hash : str, optional parameter_definition_ids : list[str] List of parameter definition IDs. @@ -55,7 +56,7 @@ class JobDefinition(Object): task_definition_ids : list[str] List of task definition IDs. fitness_definition : FitnessDefinitionBase, optional - :class:`FitnessDefinition` object. + A :class:`FitnessDefinition` object. """ class Meta: diff --git a/src/ansys/hps/client/jms/resource/license_context.py b/src/ansys/hps/client/jms/resource/license_context.py index abcb302df..aa2fca0ac 100644 --- a/src/ansys/hps/client/jms/resource/license_context.py +++ b/src/ansys/hps/client/jms/resource/license_context.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the license context resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -35,8 +37,7 @@ class LicenseContext(Object): context_id : str, optional License context ID. environment : dict, optional - Dictionary of license context environments. - + License context environment dict. """ class Meta: diff --git a/src/ansys/hps/client/jms/resource/operation.py b/src/ansys/hps/client/jms/resource/operation.py index 605c2fb96..4495ecfc9 100644 --- a/src/ansys/hps/client/jms/resource/operation.py +++ b/src/ansys/hps/client/jms/resource/operation.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the operation resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object diff --git a/src/ansys/hps/client/jms/resource/parameter_definition.py b/src/ansys/hps/client/jms/resource/parameter_definition.py index c4c8ec363..364b523b4 100644 --- a/src/ansys/hps/client/jms/resource/parameter_definition.py +++ b/src/ansys/hps/client/jms/resource/parameter_definition.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the parameter definition resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -77,7 +79,7 @@ class FloatParameterDefinition(ParameterDefinition): display_text : str, optional Text to display as the parameter name. mode : str - Indicates if it's an input or output parameter. The mode is filled server-side. + Indicates whether it's an input or output parameter. The mode is filled server-side. type : str default : float, optional Default parameter value. @@ -86,13 +88,11 @@ class FloatParameterDefinition(ParameterDefinition): upper_limit : float, optional Upper bound for the parameter value. step : float, optional - If provided, allowable values are given by: AllowableValue = lower_limit + n * step, where n - is an integer and AllowableValue <= upper_limit. + If provided, allowable values are given by: AllowableValue = lower_limit + n * step, where n is an integer and AllowableValue <= upper_limit. cyclic : bool, optional Whether the parameter is cyclic. value_list : list, optional - List of allowed values. This parameter provides an alternative to specifying - upper and lower limits. + List of allowed values. This parameter provides an alternative to specifying upper and lower limits. """ class Meta: @@ -145,7 +145,7 @@ def __init__( class IntParameterDefinition(ParameterDefinition): - """Provides the integer parameter definition resource. + """Provides the int parameter definition resource. Parameters ---------- @@ -168,7 +168,7 @@ class IntParameterDefinition(ParameterDefinition): display_text : str, optional Text to display as the parameter name. mode : str - Indicates if it's an input or output parameter. The mode is filled server-side. + Indicates whether it's an input or output parameter. The mode is filled server-side. type : str default : int, optional Default parameter value. @@ -180,7 +180,6 @@ class IntParameterDefinition(ParameterDefinition): The default is ``1``. cyclic : bool, optional Whether the parameter is cyclic. - """ class Meta: @@ -231,7 +230,7 @@ def __init__( class BoolParameterDefinition(ParameterDefinition): - """Provides the Boolean parameter definition resource. + """Provides the bool parameter definition resource. Parameters ---------- diff --git a/src/ansys/hps/client/jms/resource/parameter_mapping.py b/src/ansys/hps/client/jms/resource/parameter_mapping.py index 0669a92a1..ba24d3c96 100644 --- a/src/ansys/hps/client/jms/resource/parameter_mapping.py +++ b/src/ansys/hps/client/jms/resource/parameter_mapping.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the parameter mapping resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -55,8 +57,7 @@ class ParameterMapping(Object): true_string : str, optional false_string : str, optional parameter_definition_id : str, optional - ID of the linked parameter definition. For more information, see the - :class:`ParameterDefinition` class. + ID of the linked parameter definition. For more information, see the :class:`ParameterDefinition` class. task_definition_property : str, optional file_id : str, optional ID of the file resource. diff --git a/src/ansys/hps/client/jms/resource/permission.py b/src/ansys/hps/client/jms/resource/permission.py index 2ef8c182d..b3d597489 100644 --- a/src/ansys/hps/client/jms/resource/permission.py +++ b/src/ansys/hps/client/jms/resource/permission.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the permission resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -39,7 +41,6 @@ class Permission(Object): value_name : str, optional role : str Role of the user. Options are ``'admin'``, ``'reader'``, and ``'writer'``. - """ class Meta: diff --git a/src/ansys/hps/client/jms/resource/project.py b/src/ansys/hps/client/jms/resource/project.py index fe91886c9..cab3eed89 100644 --- a/src/ansys/hps/client/jms/resource/project.py +++ b/src/ansys/hps/client/jms/resource/project.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the project resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -46,7 +48,6 @@ class Project(Object): Date and time that the project was last modified. statistics : dict, optional Dictionary containing various project statistics. - """ class Meta: diff --git a/src/ansys/hps/client/jms/resource/selection.py b/src/ansys/hps/client/jms/resource/selection.py index 6f857b9b2..5bffcccb7 100644 --- a/src/ansys/hps/client/jms/resource/selection.py +++ b/src/ansys/hps/client/jms/resource/selection.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the selection resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object diff --git a/src/ansys/hps/client/jms/resource/task.py b/src/ansys/hps/client/jms/resource/task.py index c5069ef04..16ced3e7e 100644 --- a/src/ansys/hps/client/jms/resource/task.py +++ b/src/ansys/hps/client/jms/resource/task.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the task resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -59,8 +61,7 @@ class Task(Object): task_definition_id : str ID of the :class:`TaskDefinition` instance that the task is linked to. task_definition_snapshot : TaskDefinition, optional - Snapshot of the :class:`TaskDefinition` instance that was created when - the task status changed to prolog, before evaluation. + Snapshot of the :class:`TaskDefinition` instance that was created when the task status changed to prolog, before evaluation. executed_command : str, optional job_id : str ID of the :class:`Job` instance that the task is linked to. diff --git a/src/ansys/hps/client/jms/resource/task_definition.py b/src/ansys/hps/client/jms/resource/task_definition.py index 4672cf6d2..509deabe7 100644 --- a/src/ansys/hps/client/jms/resource/task_definition.py +++ b/src/ansys/hps/client/jms/resource/task_definition.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the task definition resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -35,7 +37,7 @@ class HpcResources(Object): - """Provides the HPC resource. + """Provides the hpc resources resource. Parameters ---------- @@ -90,7 +92,7 @@ class ResourceRequirements(Object): custom : dict[str, int | float | str | bool], optional Dictionary of custom resource requirements. hpc_resources : HpcResources, optional - HPC resources. + HPC resource requirements. """ class Meta: @@ -131,7 +133,6 @@ class Software(Object): Name of the app. version : str, optional Version of the app. - """ class Meta: @@ -201,7 +202,6 @@ class Licensing(Object): ---------- enable_shared_licensing : bool, optional Whether to enable shared licensing contexts for Ansys simulations. - """ class Meta: diff --git a/src/ansys/hps/client/jms/resource/task_definition_template.py b/src/ansys/hps/client/jms/resource/task_definition_template.py index 73f44873b..9b42afb2f 100644 --- a/src/ansys/hps/client/jms/resource/task_definition_template.py +++ b/src/ansys/hps/client/jms/resource/task_definition_template.py @@ -19,7 +19,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + # autogenerated code +"""Module providing the task definition template resource.""" from marshmallow.utils import missing from ansys.hps.client.common import Object @@ -170,7 +172,6 @@ class TemplateOutputFile(Object): Whether to live monitor the file's contents. collect : bool, optional Whether to collect files per job. - """ class Meta: diff --git a/src/ansys/hps/client/jms/schema/algorithm.py b/src/ansys/hps/client/jms/schema/algorithm.py index 4e030410c..40f2c4fd6 100644 --- a/src/ansys/hps/client/jms/schema/algorithm.py +++ b/src/ansys/hps/client/jms/schema/algorithm.py @@ -40,8 +40,8 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): data = fields.String( allow_none=True, metadata={ - "description": "Generic string field to hold arbitrary algorithm configuration data," - " e.g. as JSON dictionary.", + "description": "Generic string field to hold arbitrary algorithm configuration data. " + "For example, as a JSON dictionary.", }, ) job_ids = IdReferenceList("Job", attribute="jobs", metadata={"description": "List of job IDs."}) diff --git a/src/ansys/hps/client/jms/schema/job.py b/src/ansys/hps/client/jms/schema/job.py index a00a488dd..00f21af9c 100644 --- a/src/ansys/hps/client/jms/schema/job.py +++ b/src/ansys/hps/client/jms/schema/job.py @@ -52,15 +52,18 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=False, attribute="job_definition_id", referenced_class="JobDefinition", - metadata={"description": "ID of the linked job definition, " "see :class:`JobDefinition`."}, + metadata={ + "description": "ID of the linked job definition. " + "For more information, see the :class:`JobDefinition` class." + }, ) priority = fields.Integer( allow_none=True, metadata={ - "description": "Priority with which jobs are evaluated. The default is 0, " - "which is the highest priority. Assigning a higher value to a job " - "makes it a lower priority." + "description": "Priority for evaluating the job. " + "The default is ``0``, which is the highest priority. " + "Assigning a higher value to a job makes it a lower priority." }, ) values = fields.Dict( @@ -80,32 +83,33 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): "description": "Dictionary with (name,value) pairs for all fitness terms computed." }, ) - note = fields.String(allow_none=True, metadata={"description": "Optional note for this job."}) + note = fields.String(allow_none=True, metadata={"description": "Note for the job."}) creator = fields.String( - allow_none=True, metadata={"description": "Optional name/ID of the creator of this job."} + allow_none=True, + metadata={"description": "Additional information about the creator of the job."}, ) executed_level = fields.Integer( allow_none=True, metadata={ - "description": "Execution level of the last executed " - "task (-1 if none has been executed yet)." + "description": "Execution level of the last executed task. " + "A value of ``-1`` indicates that no task has been executed yet." }, ) elapsed_time = fields.Float( load_only=True, - metadata={"description": "Number of seconds it took the evaluator(s) to update the job."}, + metadata={"description": "Number of seconds it took the evaluators to update the job."}, ) host_ids = fields.List( fields.String(allow_none=True), allow_none=True, - metadata={"description": "List of Host IDs of the evaluators that updated the job."}, + metadata={"description": "List of host IDs of the evaluators that updated the job."}, ) file_ids = IdReferenceList( referenced_class="File", attribute="file_ids", load_only=True, - metadata={"description": "List of IDs of all files of this job."}, + metadata={"description": "List of IDs of all files of the job."}, ) diff --git a/src/ansys/hps/client/jms/schema/job_definition.py b/src/ansys/hps/client/jms/schema/job_definition.py index 5d0fa306c..20164cfa5 100644 --- a/src/ansys/hps/client/jms/schema/job_definition.py +++ b/src/ansys/hps/client/jms/schema/job_definition.py @@ -36,13 +36,8 @@ class JobDefinitionSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, metadata={"description": "Name of the job definition"}) - active = fields.Boolean( - metadata={ - "description": "Defines whether this is the active job definition in the " - "project where evaluators will evaluate pending jobs" - } - ) + name = fields.String(allow_none=True, metadata={"description": "Name of the job definition."}) + active = fields.Boolean(metadata={"description": "Whether this job definition is active."}) client_hash = fields.String(allow_none=True) parameter_definition_ids = IdReferenceList( diff --git a/src/ansys/hps/client/jms/schema/license_context.py b/src/ansys/hps/client/jms/schema/license_context.py index 67d0d7c26..1f1a55fa6 100644 --- a/src/ansys/hps/client/jms/schema/license_context.py +++ b/src/ansys/hps/client/jms/schema/license_context.py @@ -30,8 +30,8 @@ class Meta(BaseSchema.Meta): pass context_id = fields.String( - allow_none=True, load_only=True, metadata={"description": "License context ID"} + allow_none=True, load_only=True, metadata={"description": "License context ID."} ) environment = fields.Dict( - allow_none=True, metadata={"description": "License context environment dict"} + allow_none=True, metadata={"description": "License context environment dict."} ) diff --git a/src/ansys/hps/client/jms/schema/parameter_definition.py b/src/ansys/hps/client/jms/schema/parameter_definition.py index 4e0a20ec7..4ac6737bc 100644 --- a/src/ansys/hps/client/jms/schema/parameter_definition.py +++ b/src/ansys/hps/client/jms/schema/parameter_definition.py @@ -38,7 +38,10 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): quantity_name = fields.String( allow_none=True, - metadata={"description": "Name of the quantity the parameter represents, e.g. Length."}, + metadata={ + "description": "Name of the quantity that the parameter represents. " + "For example, ``Length``." + }, ) units = fields.String(allow_none=True, metadata={"description": "Units for the parameter."}) display_text = fields.String( @@ -49,7 +52,7 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): load_only=True, metadata={ "description": "Indicates whether it's an input " - "or output parameter. Filled server side." + "or output parameter. The mode is filled server-side." }, ) @@ -75,14 +78,14 @@ class Meta(ParameterDefinitionBaseSchema.Meta): }, ) cyclic = fields.Bool( - allow_none=True, metadata={"description": "Indicates if the parameter is cyclic."} + allow_none=True, metadata={"description": "Whether the parameter is cyclic."} ) value_list = fields.List( fields.Float(), allow_none=True, metadata={ - "description": "A list of allowed values, alternative " - "to providing upper and lower limits." + "description": "List of allowed values. This parameter provides an alternative " + "to specifying upper and lower limits." }, ) @@ -99,9 +102,9 @@ class Meta(ParameterDefinitionBaseSchema.Meta): upper_limit = fields.Integer( allow_none=True, metadata={"description": "Upper bound for the parameter value."} ) - step = fields.Integer(allow_none=True, metadata={"description": "Equal to 1 by default."}) + step = fields.Integer(allow_none=True, metadata={"description": "The default is ``1``."}) cyclic = fields.Bool( - allow_none=True, metadata={"description": "Indicates if the parameter is cyclic."} + allow_none=True, metadata={"description": "Whether the parameter is cyclic."} ) @@ -120,7 +123,7 @@ class Meta(ParameterDefinitionBaseSchema.Meta): type = fields.Constant("string") default = fields.String(allow_none=True, metadata={"description": "Default parameter value."}) value_list = fields.List( - fields.String(), allow_none=True, metadata={"description": "A list of allowed values."} + fields.String(), allow_none=True, metadata={"description": "List of allowed values."} ) diff --git a/src/ansys/hps/client/jms/schema/parameter_mapping.py b/src/ansys/hps/client/jms/schema/parameter_mapping.py index 89ac7e8af..e18fc7c72 100644 --- a/src/ansys/hps/client/jms/schema/parameter_mapping.py +++ b/src/ansys/hps/client/jms/schema/parameter_mapping.py @@ -52,8 +52,8 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): attribute="parameter_definition_id", referenced_class="ParameterDefinition", metadata={ - "description": "ID of the linked parameter definition, " - "see :class:`ParameterDefinition`." + "description": "ID of the linked parameter definition. " + "For more information, see the :class:`ParameterDefinition` class." }, ) task_definition_property = fields.String(allow_none=True) diff --git a/src/ansys/hps/client/jms/schema/permission.py b/src/ansys/hps/client/jms/schema/permission.py index 4c0fc9d81..93e41ffee 100644 --- a/src/ansys/hps/client/jms/schema/permission.py +++ b/src/ansys/hps/client/jms/schema/permission.py @@ -30,12 +30,17 @@ class Meta(BaseSchema.Meta): pass permission_type = fields.String( - required=True, metadata={"description": "Either 'user', 'group', or 'anyone'."} - ) - value_id = fields.String( - allow_none=True, metadata={"description": "Can be the ID of a user or group."} + required=True, + metadata={ + "description": "Permission type. Options are ``'anyone'``, ``'group'``, and ``'user'``." + }, ) + value_id = fields.String(allow_none=True, metadata={"description": "ID of a user or group."}) value_name = fields.String(allow_none=True) role = fields.String( - required=True, metadata={"description": "Either 'admin', 'writer', or 'reader'."} + required=True, + metadata={ + "description": "Role of the user. " + "Options are ``'admin'``, ``'reader'``, and ``'writer'``." + }, ) diff --git a/src/ansys/hps/client/jms/schema/project.py b/src/ansys/hps/client/jms/schema/project.py index 666603089..4951cd442 100644 --- a/src/ansys/hps/client/jms/schema/project.py +++ b/src/ansys/hps/client/jms/schema/project.py @@ -39,20 +39,23 @@ class Meta(BaseSchema.Meta): active = fields.Bool( metadata={"description": "Defines whether the project is active for evaluation."} ) - priority = fields.Int(metadata={"description": "Priority to pick the project for evaluation."}) + priority = fields.Int( + metadata={"description": "Priority for picking the project for evaluation."} + ) creation_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the project was created."}, + metadata={"description": "Date and time that the project was created."}, ) modification_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the project was last modified."}, + metadata={"description": "Date and time that the project was last modified."}, ) statistics = fields.Dict( load_only=True, - metadata={"description": "Optional dictionary containing various project statistics."}, + allow_none=True, + metadata={"description": "Dictionary containing various project statistics."}, ) diff --git a/src/ansys/hps/client/jms/schema/selection.py b/src/ansys/hps/client/jms/schema/selection.py index 80badd681..076e6c576 100644 --- a/src/ansys/hps/client/jms/schema/selection.py +++ b/src/ansys/hps/client/jms/schema/selection.py @@ -39,7 +39,7 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): attribute="algorithm_id", referenced_class="DesignExplorationAlgorithm", metadata={ - "description": "ID of the :class:`Algorithm` " "the selection belongs to (optional)." + "description": "ID of the :class:`Algorithm` instance that the selection belongs to." }, ) object_ids = IdReferenceList( diff --git a/src/ansys/hps/client/jms/schema/task.py b/src/ansys/hps/client/jms/schema/task.py index e9d28f7ba..15a279beb 100644 --- a/src/ansys/hps/client/jms/schema/task.py +++ b/src/ansys/hps/client/jms/schema/task.py @@ -36,29 +36,29 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): pending_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the task was set to pending."}, + metadata={"description": "Date and time that the task was set to pending."}, ) prolog_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the task was set to prolog."}, + metadata={"description": "Date and time that the task was set to prolog."}, ) running_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the task was set to running."}, + metadata={"description": "Date and time that the task was set to running."}, ) finished_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "The date and time the task was completed."}, + metadata={"description": "Date and time that the task was completed."}, ) eval_status = fields.String(allow_none=True, metadata={"description": "Evaluation status."}) trial_number = fields.Integer( allow_none=True, load_only=True, - metadata={"description": "Which attempt to execute the process step this task represent."}, + metadata={"description": "Which attempt to execute the process step this task represents."}, ) elapsed_time = fields.Float( allow_none=True, @@ -70,14 +70,16 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=False, attribute="task_definition_id", referenced_class="TaskDefinition", - metadata={"description": "ID of the :class:`TaskDefinition` " "the task is linked to."}, + metadata={ + "description": "ID of the :class:`TaskDefinition` instance that the task is linked to." + }, ) task_definition_snapshot = fields.Nested( TaskDefinitionSchema, allow_none=True, metadata={ - "description": "Snapshot of :class:`TaskDefinition` " - "created when task status changes to prolog, before evaluation." + "description": "Snapshot of the :class:`TaskDefinition` instance that was created" + " when the task status changed to prolog, before evaluation." }, ) @@ -87,47 +89,47 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=False, attribute="job_id", referenced_class="Job", - metadata={"description": "ID of the :class:`Job` the task is linked to."}, + metadata={"description": "ID of the :class:`Job` instance that the task is linked to."}, ) host_id = fields.String( allow_none=True, - metadata={"description": "UUID of the :class:`Evaluator` that updated the task."}, + metadata={"description": "UUID of the :class:`Evaluator` instance that updated the task."}, ) input_file_ids = IdReferenceList( referenced_class="File", attribute="input_file_ids", - metadata={"description": "List of IDs of input files of task."}, + metadata={"description": "List of IDs of input files of the task."}, ) output_file_ids = IdReferenceList( referenced_class="File", attribute="output_file_ids", - metadata={"description": "List of IDs of output files of task."}, + metadata={"description": "List of IDs of output files of the task."}, ) monitored_file_ids = IdReferenceList( referenced_class="File", attribute="monitored_file_ids", - metadata={"description": "List of IDs of monitored files of task."}, + metadata={"description": "List of IDs of monitored files of the task."}, ) inherited_file_ids = IdReferenceList( referenced_class="File", attribute="inherited_file_ids", - metadata={"description": "List of IDs of inherited files of task."}, + metadata={"description": "List of IDs of inherited files of the task."}, ) owned_file_ids = IdReferenceList( referenced_class="File", attribute="owned_file_ids", - metadata={"description": "List of IDs of owned files of task."}, + metadata={"description": "List of IDs of owned files of the task."}, ) license_context_id = fields.String( allow_none=True, - metadata={"description": "ID of license context in use"}, + metadata={"description": "ID of the license context in use."}, ) custom_data = fields.Dict( allow_none=True, - metadata={"description": "Dictionary type field to store custom data."}, + metadata={"description": "Dictionary type field for storing custom data."}, ) diff --git a/src/ansys/hps/client/jms/schema/task_definition.py b/src/ansys/hps/client/jms/schema/task_definition.py index acb1c60f9..c08a647ee 100644 --- a/src/ansys/hps/client/jms/schema/task_definition.py +++ b/src/ansys/hps/client/jms/schema/task_definition.py @@ -33,8 +33,8 @@ class SoftwareSchema(BaseSchema): class Meta(BaseSchema.Meta): pass - name = fields.String(metadata={"description": "Application's name."}) - version = fields.String(allow_none=True, metadata={"description": "Application's version."}) + name = fields.String(metadata={"description": "Name of the app."}) + version = fields.String(allow_none=True, metadata={"description": "Version of the app."}) class HpcResourcesSchema(BaseSchema): @@ -49,9 +49,11 @@ class Meta: ) exclusive = fields.Bool( allow_none=True, - metadata={"description": "When set, a job can't share resources with other running jobs."}, + metadata={"description": "Whether a job can't share resources with other running jobs."}, + ) + queue = fields.Str( + allow_none=True, metadata={"description": "Name of the job scheduler queue."} ) - queue = fields.Str(allow_none=True, metadata={"description": "Name of job scheduler queue."}) class ResourceRequirementsSchema(BaseSchema): @@ -60,7 +62,9 @@ class Meta(BaseSchema.Meta): platform = fields.String( allow_none=True, - metadata={"description": "Basic platform information: 'windows' or 'linux'."}, + metadata={ + "description": "Basic platform information. Options are ``'linux'`` and ``'windows'``." + }, ) memory = fields.Int(allow_none=True, metadata={"description": "Amount of RAM in bytes."}) num_cores = fields.Float(allow_none=True, metadata={"description": "Number of cores."}) @@ -68,16 +72,17 @@ class Meta(BaseSchema.Meta): allow_none=True, metadata={"description": "Amount of disk space in bytes."} ) distributed = fields.Bool( - allow_none=True, metadata={"description": "Enable distributed parallel processing."} + allow_none=True, + metadata={"description": "Whether to enable distributed parallel processing."}, ) custom = fields.Dict( allow_none=True, keys=fields.Str(), values=RestrictedValue(), - metadata={"description": "Custom resource requirements."}, + metadata={"description": "Dictionary of custom resource requirements."}, ) hpc_resources = fields.Nested( - HpcResourcesSchema, allow_none=True, metadata={"description": "HPC requirements"} + HpcResourcesSchema, allow_none=True, metadata={"description": "HPC resource requirements."} ) @@ -88,33 +93,33 @@ class Meta(BaseSchema.Meta): return_code = fields.Int( allow_none=True, metadata={ - "description": "The process exit code that must be returned by the executed command." + "description": "Process exit code that must be returned by the executed command." }, ) expressions = fields.List( fields.String(), allow_none=True, - metadata={"description": "A list of expressions to be evaluated."}, + metadata={"description": "List of expressions to evaluate."}, ) required_output_file_ids = IdReferenceList( "File", attribute="required_output_file_ids", allow_none=True, - metadata={"description": "List of IDs of required output files."}, + metadata={"description": "List of IDs of the required output files."}, ) require_all_output_files = fields.Bool( - allow_none=True, metadata={"description": "Flag to require all output files."} + allow_none=True, metadata={"description": "Whether to require all output files."} ) required_output_parameter_ids = IdReferenceList( "ParameterDefinition", attribute="required_output_parameter_ids", allow_none=True, - metadata={"description": "List of names of required output parameters."}, + metadata={"description": "List of names of the required output parameters."}, ) require_all_output_parameters = fields.Bool( - allow_none=True, metadata={"description": "Flag to require all output parameters."} + allow_none=True, metadata={"description": "Whether to require all output parameters."} ) @@ -125,7 +130,7 @@ class Meta(BaseSchema.Meta): enable_shared_licensing = fields.Bool( allow_none=True, metadata={ - "description": "Whether to enable shared licensing contexts for Ansys simulations" + "description": "Whether to enable shared licensing contexts for Ansys simulations." }, ) @@ -138,30 +143,31 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): execution_command = fields.String( allow_none=True, - metadata={"description": "Command to execute (command or execution script is required)."}, + metadata={"description": "Command to execute. A command or execution script is required."}, ) use_execution_script = fields.Bool( allow_none=True, metadata={ - "description": "Whether to run task with the execution command or the execution script." + "description": "Whether to run the task with the execution script " + "or the execution command." }, ) execution_script_id = IdReference( referenced_class="File", allow_none=True, - metadata={"description": "Script to execute (command or execution script is required)."}, + metadata={"description": "Script to execute. A command or execution script is required."}, ) - execution_level = fields.Int(metadata={"description": "Define execution level for this task."}) + execution_level = fields.Int(metadata={"description": "Execution level for the task."}) execution_context = fields.Dict( allow_none=True, - metadata={"description": "Additional arguments to pass to the executing command"}, + metadata={"description": "Additional arguments to pass to the executing command."}, keys=fields.Str(), values=RestrictedValue(), ) environment = fields.Dict( allow_none=True, - metadata={"description": "Environment variables to set for the executed process"}, + metadata={"description": "Environment variables to set for the executed process."}, keys=fields.Str(), values=fields.Str(), ) @@ -169,11 +175,12 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=True, metadata={"description": "Maximum time in seconds for executing the task."} ) num_trials = fields.Int( - allow_none=True, metadata={"description": "Maximum number of attempts to execute the task."} + allow_none=True, + metadata={"description": "Maximum number of attempts for executing the task."}, ) store_output = fields.Bool( allow_none=True, - metadata={"description": "Specify whether to store the standard output of the task."}, + metadata={"description": "Whether to store the standard output of the task."}, ) input_file_ids = IdReferenceList( @@ -194,17 +201,17 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): licensing = fields.Nested( LicensingSchema, allow_none=True, - metadata={"description": "A :class:`Licensing` object."}, + metadata={"description": ":class:`Licensing` object."}, ) software_requirements = fields.Nested( SoftwareSchema, many=True, allow_none=True, - metadata={"description": "A list of :class:`Software` objects."}, + metadata={"description": "List of :class:`Software` objects."}, ) resource_requirements = fields.Nested( ResourceRequirementsSchema, allow_none=True, - metadata={"description": "A :class:`ResourceRequirements` object."}, + metadata={"description": ":class:`ResourceRequirements` object."}, ) diff --git a/src/ansys/hps/client/jms/schema/task_definition_template.py b/src/ansys/hps/client/jms/schema/task_definition_template.py index c6005467c..1bb6f6068 100644 --- a/src/ansys/hps/client/jms/schema/task_definition_template.py +++ b/src/ansys/hps/client/jms/schema/task_definition_template.py @@ -39,13 +39,16 @@ class Meta(BaseSchema.Meta): type = fields.String( allow_none=True, validate=validate.OneOf(["int", "float", "bool", "string"]), - metadata={"description": "Type of the property: either int, float, bool or string."}, + metadata={ + "description": "Type of the property. " + "Options are ``bool``, ``float``, ``int``, and ``string``." + }, ) value_list = fields.Raw( allow_none=True, dump_default=[], load_default=[], - metadata={"many": True, "description": "List of possible values for this property."}, + metadata={"many": True, "description": "List of possible values for the property."}, ) @@ -70,16 +73,17 @@ class Meta(BaseSchema.Meta): name = fields.String(metadata={"description": "Name of the file."}) type = fields.String( - allow_none=True, metadata={"description": "MIME type of the file, ie. text/plain."} + allow_none=True, + metadata={"description": "MIME type of the file. For example, ``text/plain``."}, ) evaluation_path = fields.String( allow_none=True, metadata={ - "description": "Path under which the file is expected to be found during evaluation." + "description": "Path that the file is expected to be found under during evaluation." }, ) description = fields.String(metadata={"description": "Description of the file's purpose."}) - required = fields.Bool(metadata={"description": "Is the file required by the task"}) + required = fields.Bool(metadata={"description": "Whether the file is required by the task."}) class TemplateInputFileSchema(TemplateFileSchema): @@ -88,10 +92,10 @@ class TemplateInputFileSchema(TemplateFileSchema): class TemplateOutputFileSchema(TemplateFileSchema): monitor = fields.Bool( - allow_none=True, metadata={"description": "Should the file's contents be live monitored."} + allow_none=True, metadata={"description": "Whether to live monitor the file's contents."} ) collect = fields.Bool( - allow_none=True, metadata={"description": "Should files be collected per job."} + allow_none=True, metadata={"description": "Whether to collect files per job."} ) @@ -102,32 +106,35 @@ class Meta(ObjectSchema.Meta): modification_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "Last time the object was modified, in UTC."}, + metadata={ + "description": "Last time in UTC (Coordinated Universal Time) " + "that the object was modified." + }, ) creation_time = fields.DateTime( allow_none=True, load_only=True, - metadata={"description": "Time when the object was created, in UTC."}, + metadata={"description": "Time in UTC when the object was created."}, ) - name = fields.String(metadata={"description": "Name of the template"}) - version = fields.String(metadata={"description": "Version of the template"}, allow_none=True) + name = fields.String(metadata={"description": "Name of the template."}) + version = fields.String(metadata={"description": "Version of the template."}, allow_none=True) description = fields.String( - metadata={"description": "Description of the template"}, allow_none=True + metadata={"description": "Description of the template."}, allow_none=True ) software_requirements = fields.Nested( SoftwareSchema, many=True, allow_none=True, - metadata={"description": "A list of required software."}, + metadata={"description": "List of required software."}, ) resource_requirements = fields.Nested( TemplateResourceRequirementsSchema, allow_none=True, metadata={ - "description": "Includes hardware requirements such as number of cores," - " memory and disk space." + "description": "Hardware requirements such as the number of cores, " + "memory, and disk space." }, ) @@ -135,23 +142,28 @@ class Meta(ObjectSchema.Meta): keys=fields.String, values=fields.Nested(TemplatePropertySchema), allow_none=True, - metadata={"description": "Additional arguments to pass to the executing command."}, + metadata={ + "description": "Dictionary of additional arguments to pass to the executing command." + }, ) environment = fields.Dict( keys=fields.String, values=fields.Nested(TemplatePropertySchema), allow_none=True, - metadata={"description": "Environment variables to set for the executed process."}, + metadata={ + "description": "Dictionary of environment variables to set for the executed process." + }, ) execution_command = fields.String( allow_none=True, - metadata={"description": "Command to execute (command or execution script is required)."}, + metadata={"description": "Command to execute. A command or execution script is required."}, ) use_execution_script = fields.Bool( allow_none=True, metadata={ - "description": "Whether to run task with the execution command or the execution script." + "description": "Whether to run the task with the execution script " + "or the execution command." }, ) execution_script_storage_id = fields.String(