Skip to content

Commit

Permalink
Merge pull request #72 from NERSC/job-models-rebuild
Browse files Browse the repository at this point in the history
Add model_rebuild for job models
  • Loading branch information
cjh1 authored Apr 10, 2024
2 parents b586131 + cfb2ac3 commit 685c498
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/sfapi_client/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,10 @@ def resources(self) -> AsyncResources:
AsyncRemotePath.model_rebuild()
AsyncRole.model_rebuild()
AsyncGroupMember.model_rebuild()

# Ensure that the job models are built, we need to import here to
# avoid circular imports
from .jobs import AsyncJobSacct, AsyncJobSqueue # noqa: E402

AsyncJobSqueue.model_rebuild()
AsyncJobSacct.model_rebuild()
5 changes: 4 additions & 1 deletion src/sfapi_client/_async/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ async def download(self, binary=False) -> IO[AnyStr]:

@staticmethod
async def _ls(
compute: "Compute", path, directory=False, filter_dots=True # noqa: F821
compute: "AsyncCompute", # noqa: F821
path,
directory=False,
filter_dots=True, # noqa: F821
) -> List["RemotePath"]: # noqa: F821
r = await compute.client.get(f"utilities/ls/{compute.name}/{path}")

Expand Down
3 changes: 2 additions & 1 deletion src/sfapi_client/_async/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class AsyncUser(UserBase):
@staticmethod
@check_auth
async def _fetch_user(
client: "AsyncClient", username: Optional[str] = None # noqa: F821
client: "AsyncClient", # noqa: F821
username: Optional[str] = None, # noqa: F821
): # noqa: F821
url = "account/"
if username is not None:
Expand Down
6 changes: 6 additions & 0 deletions src/sfapi_client/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,9 @@ def resources(self) -> Resources:
RemotePath.model_rebuild()
Role.model_rebuild()
GroupMember.model_rebuild()

# Ensure that the job models are built, we need to import here to
# avoid circular imports
from .jobs import JobSacct, JobSqueue
JobSqueue.model_rebuild()
JobSacct.model_rebuild()

0 comments on commit 685c498

Please sign in to comment.