Skip to content

Cleanup#6

Open
campbellkb wants to merge 15 commits intomainfrom
cleanup
Open

Cleanup#6
campbellkb wants to merge 15 commits intomainfrom
cleanup

Conversation

@campbellkb
Copy link
Collaborator

This pull request is intended to do a few things:

  1. Replace JSON returned values from SDK functions as Python objects.
  2. Update routes to the new S3M service
  3. Clean up any unnecessary lines and run a linter to ensure code is using best coding practices.
  4. Move 'Status' functions (that do not require authentication) out of compute.py and into its own python file.

raise S3MError(f'GET from {status_url} failed - {response.reason} ({response.status_code})')

def get_queue_status(self, queue_name : str) -> Tuple[bool, str]:
def get_system_status(self) -> Tuple[bool, dict]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should ideally pivot away from returning raw values like a Tuple of system status parts. This requires users to write something like

ok, status = client.get_system_status()

which is pretty unnatural in Py.

What I believe we should do instead is have a Python object that encompasses information about system status. Like a dataclass that includes a pointer to an enum for System state (including all the possible types like "OPERATIONAL", "DOWNGRADED", etc.).

from dataclasses import dataclass

@DataClass
class SystemStatus:
name: str
description: str
state: SystemState
upcoming_downtimes: ...
...

And then that SystemStatus object is returned (for example. Of course we can adjust the specific names / payloads / etc.)

names : str = ""

names = []
debug_msg = f'DEBUG: Slurm Queues on {self._cluster_name} - '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SDK probably shouldn't print, but pack the debug info into a returnable Python object.

info = json.dumps(job_info, indent=4)
return True, info

return True, job_info
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes here, we should architect this to be some sort of JobInfo python object that contains ENUMs for all the enumeratable Python fields (like job status can only be the SLURM job statuses of RUNNING, COMPLETED, FAILED, etc. You can see the full list (including the less common types) here:
https://slurm.schedmd.com/job_state_codes.html

@@ -49,8 +49,6 @@ def shutdown(service : StreamingService, cluster : str):

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these test files to the tests folder? These really don't serve a user-facing purpose as the CLI is a separate entity from the SDK (for now; you can chat with AJ about it if you're interested). But they can be useful for debugging. We can have a longer conversation about removing them entirely.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants