Skip to content

Conversation

@superstar54
Copy link
Member

This PR migrate the daemon routers from aiida-gui to here.

  • get_daemon_worker: details for the daemon workers.
  • increase_daemon_worker
  • decrease_daemon_worker

This PR migrate the daemon routers from aiida-gui to here.

- get_daemon_worker
- increase_daemon_worker
- decrease_daemon_worker
Comment on lines +25 to +41
class WorkerInfo(BaseModel):
"""Details for a single daemon worker (per PID)."""

mem_info1: str = Field(..., description='Resident memory.')
mem_info2: str = Field(..., description='Virtual memory.')
cpu: float = Field(..., description='CPU usage percent.')
mem: float = Field(..., description='Memory usage percent.')
ctime: str = Field(..., description='CPU time as string.')
pid: int
username: str
nice: int
create_time: float = Field(..., description='Process creation time.')
age: float = Field(..., description='Process age in seconds.')
cmdline: str
children: t.List[t.Union[int, str]] = Field(default_factory=list, description='Child PIDs.')
started: float = Field(..., description='Worker start time.')
wid: int = Field(..., description='AiiDA worker id.')
Copy link
Member

Choose a reason for hiding this comment

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

In the spirit of providing schemas for AiiDA-things, I would consider defining this model somewhere in aiida-core. Not sure where though. Also, if we drop the engine, we will also drop daemon endpoints from this package, so let's wait.

return {}

response = client.get_worker_info()
print(response['info'])
Copy link
Member

Choose a reason for hiding this comment

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

Was this print for debugging? I suggest removing it.

response = client.get_worker_info()
print(response['info'])

return response['info']
Copy link
Member

Choose a reason for hiding this comment

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

If response['info'] returns a dict[str, WorkerInfo], what is the key? The worker id?

Copy link
Member

@edan-bainglass edan-bainglass left a comment

Choose a reason for hiding this comment

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

Hi @superstar54. Sorry for the delay on this. I left some comments. Also, can you address the failing tests? 🙏

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