Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/local/system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import json
import os
import platform
import re
Expand Down Expand Up @@ -173,6 +174,14 @@ def check_running(self, name):
output = process.stdout.read()
return name in output

def info(self):
arguments = ["info", "--format", "'{{json .}}'"]
process = self._execute(arguments)
output = process.stdout.read()
info = json.loads(output)
result = {"cpu": info["NCPU"], "memory": info["MemTotal"]}
return result

def exec(self, container, command, interactive=False):
arguments = ["exec", "-it", container, command]
if interactive:
Expand Down