Integrate with data transfer worker #988
GitHub Actions / Test Report ubuntu-latest:3.10
failed
Sep 5, 2024 in 0s
89 tests run, 83 passed, 5 skipped, 1 failed.
Annotations
Check failure on line 189 in tests/jms/test_task_definition_templates.py
github-actions / Test Report ubuntu-latest:3.10
test_task_definition_templates.test_template_integration
ansys.hps.client.exceptions.HPSError: Failed to copy task_definition_templates with ids = ['02xbHeIQKFkVrlbJIIXewg'].
Raw output
client = <ansys.hps.client.client.Client object at 0x7f8c3328df30>
def test_template_integration(client):
jms_api = JmsApi(client)
# Test get queries
templates = jms_api.get_task_definition_templates()
assert len(templates) > 0
assert templates[0].id is not None
templates = jms_api.get_task_definition_templates(as_objects=False)
assert len(templates) > 0
assert templates[0]["id"] is not None
templates = jms_api.get_task_definition_templates(
as_objects=False, fields=["name", "software_requirements"]
)
assert len(templates) > 0
log.info(f"templates={json.dumps(templates, indent=4)}")
if templates:
assert "software_requirements" in templates[0].keys()
assert "name" in templates[0]["software_requirements"][0].keys()
assert "version" in templates[0]["software_requirements"][0].keys()
templates = jms_api.get_task_definition_templates(fields=["name"])
if templates:
assert templates[0].software_requirements == missing
# Create new template based on existing one
template_name = f"new_template_{uuid.uuid4()}"
templates = jms_api.get_task_definition_templates(limit=1)
assert len(templates) == 1
template = TaskDefinitionTemplate(
name=template_name, software_requirements=templates[0].software_requirements
)
template.version = "1.0"
templates = jms_api.create_task_definition_templates([template])
assert len(templates) == 1
template = templates[0]
assert template.name == template_name
# Modify template
template.software_requirements[0].version = "2.0.1"
template.resource_requirements = TemplateResourceRequirements(
hpc_resources=HpcResources(num_gpus_per_node=2)
)
templates = jms_api.update_task_definition_templates([template])
assert len(templates) == 1
template = templates[0]
assert template.software_requirements[0].version == "2.0.1"
assert template.name == template_name
assert template.resource_requirements.hpc_resources.num_gpus_per_node == 2
# Delete template
jms_api.delete_task_definition_templates([template])
templates = jms_api.get_task_definition_templates(name=template_name)
assert len(templates) == 0
# Copy template
templates = jms_api.get_task_definition_templates(limit=1)
assert len(templates) == 1
original_template = templates[0]
> new_template_id = jms_api.copy_task_definition_templates(templates)
tests/jms/test_task_definition_templates.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py310-coverage/lib/python3.10/site-packages/ansys/hps/client/jms/api/jms_api.py:214: in copy_task_definition_templates
return _copy_objects(self.client, self.url, templates, wait=wait)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <ansys.hps.client.client.Client object at 0x7f8c3328df30>
api_url = 'https://localhost:8443/hps/jms/api/v1'
objects = [TaskDefinitionTemplate(id='02xbHeIQKFkVrlbJIIXewg',modification_time=datetime.datetime(2024, 9, 5, 5, 17, 53, 558573, tzinfo=datetime.timezone(datetime.timedelta(0), '+0000')),creation_time=datetime.datetime(2024, 9, 5, 5, 17, 53, 558573, tzinfo=datetime.timezone(datetime.timedelta(0), '+0000')),name='[Dev] Ansys Structural Optimization 2024 R2',version='0.1',description=<marshmallow.missing>,software_requirements=[Software(name='Ansys Structural Optimization',version='2024 R2'), Software(name='Ansys Mechanical APDL',version='2024 R2')],resource_requirements=TemplateResourceRequirements(platform=<marshmallow.missing>,memory=<marshmallow.missing>,num_cores=TemplateProperty(default=4,description='',type=<marshmallow.missing>,value_list=[]),disk_space=<marshmallow.missing>,distributed=TemplateProperty(default=True,description='',type=<marshmallow.missing>,value_list=[]),compute_resource_set_id=<marshmallow.missing>,evaluator_id=<marshmallow.missing>,custom=<marshmallow.missing>,hpc_resources=<marshmallow.missing>),worker_context=None,execution_context={'additional_args': TemplateProperty(default=None,description='Additional command line arguments.',type='string',value_list=[]), 'mpi_type': TemplateProperty(default=None,description='Specifies the type of MPI to use.',type='string',value_list=['intelmpi', 'intelmpi2018', 'openmpi', 'msmpi']), 'optimizer_type': TemplateProperty(default='lvls',description='Optimizer type to run. ',type='string',value_list=['lvls', 'dens'])},environment={'ANSWAIT': TemplateProperty(default='1',description='An environment variable that will allow you to queue your Ansys job in the event that all Ansys licenses are in use. Once a license becomes available and you are next on the queue, your Ansys job will automatically start.',type=<marshmallow.missing>,value_list=[])},execution_command=None,use_execution_script=True,execution_script_storage_id='struct_opt-v242-exec_struct_opt.py',execution_script_storage_bucket='default_execution_scripts',input_files=[TemplateOutputFile(name='opt_inp',type='text/plain',evaluation_path=<marshmallow.missing>,description='Optimizer input file.',required=True,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='mapdl_inp',type='text/plain',evaluation_path=<marshmallow.missing>,description='MAPDL input file',required=True,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='appendInput',type='text/plain',evaluation_path=<marshmallow.missing>,description='Appended input for optimizer, currently needed to overwrite paths',required=True,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='db0',type='application/octet-stream',evaluation_path=<marshmallow.missing>,description='MAPDL DB file of first upstream analysis',required=True,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='rst0',type='application/octet-stream',evaluation_path=<marshmallow.missing>,description='RST file of upstream analysis',required=True,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='db1',type='application/octet-stream',evaluation_path=<marshmallow.missing>,description='MAPDL DB file of second upstream analysis',required=False,monitor=<marshmallow.missing>,collect=<marshmallow.missing>), TemplateOutputFile(name='db2',type='application/octet-stream',evaluation_path=<marshmallow.missing>,description='MAPDL DB file of third upstream analysis',required=False,monitor=<marshmallow.missing>,collect=<marshmallow.missing>)],output_files=[TemplateOutputFile(name='out',type='text/plain',evaluation_path='solve.out',description='File to store the output from a batch execution of MAPDL.',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='cnd',type='application/octet-stream',evaluation_path='file.cnd',description='Contact pair-based results.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='dsp',type='text/plain',evaluation_path='file.DSP',description='Stores performance information when running the sparse solver.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='mntr',type='text/plain',evaluation_path='file.mntr',description='Nonlinear analysis convergence monitoring. See https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v222/en/ans_bas/Hlp_G_BAS18_4.html?q=mntr',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='rst',type='application/octet-stream',evaluation_path='file.rst',description='Results for a structural analysis and coupled-field analysis.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='rth',type='application/octet-stream',evaluation_path='file.rth',description='Results for a thermal and diffusion analyses.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='rmg',type='application/octet-stream',evaluation_path='file.rmg',description='Results for a magnetic field analysis.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='err',type='text/plain',evaluation_path='file0.err',description='Error and warning messages.',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='gst',type='text/plain',evaluation_path='file.gst',description='Graphical solution tracking file.',required=<marshmallow.missing>,monitor=False,collect=True), TemplateOutputFile(name='topo',type='text/plain',evaluation_path='topo.*',description='Topo log files',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='objective_history',type='text/plain',evaluation_path='ObjectiveHistory.out',description='Objective history',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='structured_history',type='text/plain',evaluation_path='structured_history.xml',description='Structured history',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='debug',type='text/plain',evaluation_path='debugInfo/*.txt',description='Debug info if available',required=<marshmallow.missing>,monitor=True,collect=True), TemplateOutputFile(name='h5',type='application/octet-stream',evaluation_path='*.h5',description='DPF H5 files if available',required=<marshmallow.missing>,monitor=False,collect=True)])]
wait = True
def _copy_objects(
client: Client, api_url: str, objects: List[Object], wait: bool = True
) -> Union[str, List[str]]:
"""Copy objects."""
operation_id = base_copy_objects(client.session, api_url, objects)
if not wait:
return operation_id
op = _monitor_operation(JmsApi(client), operation_id, 1.0)
if not op.succeeded:
obj_type = objects[0].__class__
rest_name = obj_type.Meta.rest_name
> raise HPSError(f"Failed to copy {rest_name} with ids = {[obj.id for obj in objects]}.")
E ansys.hps.client.exceptions.HPSError: Failed to copy task_definition_templates with ids = ['02xbHeIQKFkVrlbJIIXewg'].
.tox/py310-coverage/lib/python3.10/site-packages/ansys/hps/client/jms/api/jms_api.py:403: HPSError
Loading