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

Add example to the user guide: how to determine who create or last modified a resource #332

Closed
FedericoNegri opened this issue Feb 20, 2024 · 0 comments · Fixed by #352
Closed
Labels
documentation Improvements or additions to documentation

Comments

@FedericoNegri
Copy link
Contributor

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}'"
)
@FedericoNegri FedericoNegri added the documentation Improvements or additions to documentation label Feb 20, 2024
@FedericoNegri FedericoNegri linked a pull request Mar 5, 2024 that will close this issue
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant