Closed
Description
Example code snippet for jobs (same works for task and job definitions):
from ansys.hps.client import Client, ProjectApi, AuthApi
cl = Client(username="repuser", password="repuser")
project_api = ProjectApi(cl, "02vm5JzrGmkhOX87It1Cnd")
auth_api = AuthApi(cl)
# job
job = project_api.get_jobs()[0]
created_by = auth_api.get_user(id=job.created_by)
modified_by = auth_api.get_user(id=job.modified_by)
print(
f"Job '{job.name}' was created by '{created_by.username}' "
f"and last modified by '{modified_by.username}'"
)
Activity