some updates, cant remember what for

This commit is contained in:
Ari Brown 2025-01-22 10:09:36 -05:00
parent 92c769a2b0
commit cd5ce7e16f
3 changed files with 12 additions and 9 deletions

View file

@ -1,4 +1,8 @@
* start docker containers via method on Machine()
* control and automate logfiles
* add logfile for `docker events`
* build web frontend
* identify containers that error out
* oomkill is common with docker because you're not allowed to suddenly reach
for swap space (???)
* removing this functionality is difficult and OS-dependent

View file

@ -19,7 +19,7 @@ class Command:
self.machine = machine
self.command = command
self.disown = disown
self.watch = True#watch
self.watch = watch
self.logset = logset
self.thread = None
@ -36,8 +36,6 @@ class Command:
# https://github.com/paramiko/paramiko/issues/593#issuecomment-145377328
#
def execute(self):
print(f"running: {self.command}")
print("\t", self.logset)
stdin, stdout, stderr = self.machine.ssh.client.exec_command(self.command)
# this is the same for all three inputs
@ -88,20 +86,16 @@ class Command:
break
for c in readq:
if c.recv_ready():
print(f"\t{len(c.in_buffer)} in stdout")
flush_data(channel.recv(len(c.in_buffer)),
out,
(self.watch and sys.stdout.buffer))
got_chunk = True
print(f"\t{len(c.in_buffer)} left in stdout")
if c.recv_stderr_ready():
print(f"\t{len(c.in_stderr_buffer)} in stderr")
flush_data(channel.recv_stderr(len(c.in_stderr_buffer)),
err,
(self.watch and sys.stderr.buffer))
got_chunk = True
print(f"\t{len(c.in_stderr_buffer)} left in stderr")
# for c
"""

View file

@ -22,6 +22,10 @@ class Machine(minerva.Remote):
public = True,
disk_size = 8):
if not key_pair or not key_pair[1]:
key_pair = (pier.key_pair_name, pier.key_path)
super().__init__(None, username, key_pair[1], name)
self.pier = pier
@ -50,7 +54,7 @@ class Machine(minerva.Remote):
res = self.pier.ec2.run_instances(
ImageId = self.ami,
InstanceType = self.instance_type,
KeyName = self.key_pair[0] or self.pier.key_pair_name,
KeyName = self.key_pair[0],
MinCount = 1,
MaxCount = 1,
TagSpecifications = [{'ResourceType': 'instance',
@ -127,6 +131,7 @@ class Machine(minerva.Remote):
self.public_ip = self.description['PublicIpAddress']
print(f"\t{self.name} ({self.info['InstanceId']}\t- {self.instance_type}) => {self.public_ip} ({self.private_ip})")
print(repr(self.key_pair))
self.ip = self.public_ip or self.private_ip
self.ssh = Connection(self.ip,