Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansys/rep/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
from .client import Client
from .exceptions import APIError, ClientError, REPError
from .jms import JmsApi, ProjectApi
from .warnings import UnverifiedHTTPSRequestsWarning
16 changes: 10 additions & 6 deletions ansys/rep/client/auth/schema/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ class Meta(BaseSchema.Meta):

id = fields.String(
load_only=True,
description="Unique user ID, generated internally by the server on creation.",
metadata={"description": "Unique user ID, generated internally by the server on creation."},
)
username = fields.Str(description="Username.")
password = fields.Str(dump_only=True, description="Password.")
firstName = fields.Str(allow_none=True, description="First name", attribute="first_name")
lastName = fields.Str(allow_none=True, description="Last name", attribute="last_name")
email = fields.Str(allow_none=True, description="E-mail address (optional).")
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"
)
lastName = fields.Str(
allow_none=True, metadata={"description": "Last name"}, attribute="last_name"
)
email = fields.Str(allow_none=True, metadata={"description": "E-mail address (optional)."})
3 changes: 2 additions & 1 deletion ansys/rep/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .auth.authenticate import authenticate
from .connection import create_session
from .exceptions import raise_for_status
from .warnings import UnverifiedHTTPSRequestsWarning

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -122,7 +123,7 @@ def __init__(
f"Certificate verification is disabled. "
f"Unverified HTTPS requests will be made to {self.rep_url}."
)
warnings.warn(msg, Warning)
warnings.warn(msg, UnverifiedHTTPSRequestsWarning)
log.warning(msg)

if disable_security_warnings:
Expand Down
14 changes: 9 additions & 5 deletions ansys/rep/client/jms/schema/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ class AlgorithmSchema(ObjectSchemaWithModificationInfo):
class Meta(ObjectSchemaWithModificationInfo.Meta):
pass

name = fields.String(allow_none=True, description="Name of the algorithm.")
description = fields.String(allow_none=True, description="Description of the algorithm.")
name = fields.String(allow_none=True, metadata={"description": "Name of the algorithm."})
description = fields.String(
allow_none=True, metadata={"description": "Description of the algorithm."}
)

data = fields.String(
allow_none=True,
description="Generic string field to hold arbitrary algorithm configuration data,"
" e.g. as JSON dictionary.",
metadata={
"description": "Generic string field to hold arbitrary algorithm configuration data,"
" e.g. as JSON dictionary.",
},
)
job_ids = IdReferenceList("Job", attribute="jobs", description="List of job IDs.")
job_ids = IdReferenceList("Job", attribute="jobs", metadata={"description": "List of job IDs."})
35 changes: 22 additions & 13 deletions ansys/rep/client/jms/schema/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ class FileSchema(ObjectSchemaWithModificationInfo):
class Meta(ObjectSchemaWithModificationInfo.Meta):
pass

name = fields.String(description="Name of the file resource.")
name = fields.String(metadata={"description": "Name of the file resource."})
type = fields.String(
allow_none=True,
description="Type of the file. This can be any string but using a correct media "
"type for the given resource is advisable.",
metadata={
"description": "Type of the file. This can be any string but using a correct media "
"type for the given resource is advisable."
},
)
storage_id = fields.String(
allow_none=True, description="File's identifier in the (orthogonal) file storage system"
allow_none=True,
metadata={"description": "File's identifier in the (orthogonal) file storage system"},
)

size = fields.Int(allow_none=True)
Expand All @@ -38,25 +41,31 @@ class Meta(ObjectSchemaWithModificationInfo.Meta):
format = fields.String(allow_none=True)
evaluation_path = fields.String(
allow_none=True,
description="Relative path under which the file instance for a "
"job evaluation will be stored.",
metadata={
"description": "Relative path under which the file instance for a "
"job evaluation will be stored.",
},
)

monitor = fields.Bool(
allow_none=True, description="Whether to live monitor the file's content."
allow_none=True, metadata={"description": "Whether to live monitor the file's content."}
)
collect = fields.Bool(
allow_none=True, metadata={"description": "Whether file should be collected per job"}
)
collect = fields.Bool(allow_none=True, description="Whether file should be collected per job")
collect_interval = fields.Int(
allow_none=True,
description="Collect frequency for a file with collect=True."
" Min value limited by the evaluator's settings."
" 0/None - let the evaluator decide,"
" other value - interval in seconds",
metadata={
"description": "Collect frequency for a file with collect=True."
" Min value limited by the evaluator's settings."
" 0/None - let the evaluator decide,"
" other value - interval in seconds"
},
)

reference_id = IdReference(
attribute="reference_id",
referenced_class="File",
allow_none=True,
description="Reference file from which this one was created",
metadata={"description": "Reference file from which this one was created"},
)
20 changes: 14 additions & 6 deletions ansys/rep/client/jms/schema/fitness_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ class FitnessTermDefinitionSchema(ObjectSchema):
class Meta(ObjectSchema.Meta):
pass

name = fields.String(allow_none=True, description="Name of the fitness term.")
name = fields.String(allow_none=True, metadata={"description": "Name of the fitness term."})
expression = fields.String(
allow_none=True, description="The Python expression that defines the fitness term."
allow_none=True,
metadata={"description": "The Python expression that defines the fitness term."},
)
type = fields.String(
allow_none=True, validate=OneOf(fitness_term_types), description="Fitness term type."
allow_none=True,
validate=OneOf(fitness_term_types),
metadata={"description": "Fitness term type."},
)
weighting_factor = fields.Float(
allow_none=True,
description="Relative importance of the fitness term in comparison to other fitness terms.",
metadata={
"description": "Relative importance of the fitness "
"term in comparison to other fitness terms."
},
)


Expand All @@ -38,6 +44,8 @@ class Meta(ObjectSchema.Meta):
fitness_term_definitions = fields.Nested(
FitnessTermDefinitionSchema,
many=True,
description="List of :class:`FitnessTermDefinition`.",
metadata={"description": "List of :class:`FitnessTermDefinition`."},
)
error_fitness = fields.Float(
metadata={"description": "The default fitness value assigned to failed jobs."}
)
error_fitness = fields.Float(description="The default fitness value assigned to failed jobs.")
44 changes: 27 additions & 17 deletions ansys/rep/client/jms/schema/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,59 +29,69 @@ class JobSchema(ObjectSchemaWithModificationInfo):
class Meta(ObjectSchemaWithModificationInfo.Meta):
pass

name = fields.String(allow_none=True, description="Name of the job.")
eval_status = fields.String(validate=OneOf(valid_eval_status), description="Evaluation status.")
name = fields.String(allow_none=True, metadata={"description": "Name of the job."})
eval_status = fields.String(
validate=OneOf(valid_eval_status), metadata={"description": "Evaluation status."}
)
job_definition_id = IdReference(
allow_none=False,
attribute="job_definition_id",
referenced_class="JobDefinition",
description="ID of the linked job definition, " "see :class:`JobDefinition`.",
metadata={"description": "ID of the linked job definition, " "see :class:`JobDefinition`."},
)

priority = fields.Integer(
allow_none=True,
default=0,
description="Priority with which jobs are evaluated. The default is 0, "
"which is the highest priority. Assigning a higher value to a design "
"point makes it a lower priority.",
metadata={
"description": "Priority with which jobs are evaluated. The default is 0, "
"which is the highest priority. Assigning a higher value to a design "
"point makes it a lower priority."
},
)
values = fields.Dict(
keys=fields.String(),
allow_none=True,
description="Dictionary with (name,value) pairs for all parameters defined in the "
"linked job definition.",
metadata={
"description": "Dictionary with (name,value) pairs for all parameters defined in the "
"linked job definition."
},
)
fitness = fields.Float(allow_none=True, description="Fitness value computed.")
fitness = fields.Float(allow_none=True, metadata={"description": "Fitness value computed."})
fitness_term_values = fields.Dict(
keys=fields.String(),
values=fields.Float(allow_none=True),
allow_none=True,
description="Dictionary with (name,value) pairs for all fitness terms computed.",
metadata={
"description": "Dictionary with (name,value) pairs for all fitness terms computed."
},
)
note = fields.String(allow_none=True, description="Optional note for this job.")
note = fields.String(allow_none=True, metadata={"description": "Optional note for this job."})
creator = fields.String(
allow_none=True, description="Optional name/ID of the creator of this job."
allow_none=True, metadata={"description": "Optional name/ID of the creator of this job."}
)

executed_level = fields.Integer(
allow_none=True,
description="Execution level of the last executed "
"task (-1 if none has been executed yet).",
metadata={
"description": "Execution level of the last executed "
"task (-1 if none has been executed yet)."
},
)

elapsed_time = fields.Float(
load_only=True,
description="Number of seconds it took the evaluator(s) to update the job.",
metadata={"description": "Number of seconds it took the evaluator(s) to update the job."},
)

host_ids = fields.List(
fields.String(allow_none=True),
allow_none=True,
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,
description="List of IDs of all files of this job.",
metadata={"description": "List of IDs of all files of this job."},
)
22 changes: 15 additions & 7 deletions ansys/rep/client/jms/schema/job_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,33 @@ class JobDefinitionSchema(ObjectSchemaWithModificationInfo):
class Meta(ObjectSchemaWithModificationInfo.Meta):
pass

name = fields.String(allow_none=True, description="Name of the job definition")
name = fields.String(allow_none=True, metadata={"description": "Name of the job definition"})
active = fields.Boolean(
description="Defines whether this is the active job definition in the "
"project where evaluators will evaluate pending jobs"
metadata={
"description": "Defines whether this is the active job definition in the "
"project where evaluators will evaluate pending jobs"
}
)
client_hash = fields.String(allow_none=True)

parameter_definition_ids = IdReferenceList(
referenced_class="ParameterDefinition", attribute="parameter_definition_ids", description=""
referenced_class="ParameterDefinition",
attribute="parameter_definition_ids",
metadata={"description": "List of parameter definition IDs."},
)
parameter_mapping_ids = IdReferenceList(
referenced_class="ParameterMapping", attribute="parameter_mapping_ids", description=""
referenced_class="ParameterMapping",
attribute="parameter_mapping_ids",
metadata={"description": "List of parameter mapping IDs."},
)
task_definition_ids = IdReferenceList(
referenced_class="TaskDefinition", attribute="task_definition_ids", description=""
referenced_class="TaskDefinition",
attribute="task_definition_ids",
metadata={"description": "List of task definition IDs."},
)

fitness_definition = fields.Nested(
FitnessDefinitionSchema,
allow_none=True,
description="A :class:`FitnessDefinition` object.",
metadata={"description": "A :class:`FitnessDefinition` object."},
)
8 changes: 6 additions & 2 deletions ansys/rep/client/jms/schema/license_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ class LicenseContextSchema(BaseSchema):
class Meta(BaseSchema.Meta):
pass

context_id = fields.String(allow_none=True, load_only=True, description="License context ID")
environment = fields.Dict(allow_none=True, description="License context environment dict")
context_id = fields.String(
allow_none=True, load_only=True, metadata={"description": "License context ID"}
)
environment = fields.Dict(
allow_none=True, metadata={"description": "License context environment dict"}
)
Loading