Skip to content

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

Closed
@FedericoNegri

Description

@FedericoNegri
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}'"
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @FedericoNegri

      Issue actions

        Add example to the user guide: how to determine who create or last modified a resource · Issue #332 · ansys/pyhps