forked from bellwether/minerva
some updates, cant remember what for
This commit is contained in:
parent
92c769a2b0
commit
cd5ce7e16f
3 changed files with 12 additions and 9 deletions
6
TODO.md
6
TODO.md
|
|
@ -1,4 +1,8 @@
|
||||||
* start docker containers via method on Machine()
|
* start docker containers via method on Machine()
|
||||||
* control and automate logfiles
|
* control and automate logfiles
|
||||||
* add logfile for `docker events`
|
* 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
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class Command:
|
||||||
self.machine = machine
|
self.machine = machine
|
||||||
self.command = command
|
self.command = command
|
||||||
self.disown = disown
|
self.disown = disown
|
||||||
self.watch = True#watch
|
self.watch = watch
|
||||||
self.logset = logset
|
self.logset = logset
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
|
||||||
|
|
@ -36,8 +36,6 @@ class Command:
|
||||||
# https://github.com/paramiko/paramiko/issues/593#issuecomment-145377328
|
# https://github.com/paramiko/paramiko/issues/593#issuecomment-145377328
|
||||||
#
|
#
|
||||||
def execute(self):
|
def execute(self):
|
||||||
print(f"running: {self.command}")
|
|
||||||
print("\t", self.logset)
|
|
||||||
stdin, stdout, stderr = self.machine.ssh.client.exec_command(self.command)
|
stdin, stdout, stderr = self.machine.ssh.client.exec_command(self.command)
|
||||||
|
|
||||||
# this is the same for all three inputs
|
# this is the same for all three inputs
|
||||||
|
|
@ -88,20 +86,16 @@ class Command:
|
||||||
break
|
break
|
||||||
for c in readq:
|
for c in readq:
|
||||||
if c.recv_ready():
|
if c.recv_ready():
|
||||||
print(f"\t{len(c.in_buffer)} in stdout")
|
|
||||||
flush_data(channel.recv(len(c.in_buffer)),
|
flush_data(channel.recv(len(c.in_buffer)),
|
||||||
out,
|
out,
|
||||||
(self.watch and sys.stdout.buffer))
|
(self.watch and sys.stdout.buffer))
|
||||||
got_chunk = True
|
got_chunk = True
|
||||||
print(f"\t{len(c.in_buffer)} left in stdout")
|
|
||||||
|
|
||||||
if c.recv_stderr_ready():
|
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)),
|
flush_data(channel.recv_stderr(len(c.in_stderr_buffer)),
|
||||||
err,
|
err,
|
||||||
(self.watch and sys.stderr.buffer))
|
(self.watch and sys.stderr.buffer))
|
||||||
got_chunk = True
|
got_chunk = True
|
||||||
print(f"\t{len(c.in_stderr_buffer)} left in stderr")
|
|
||||||
# for c
|
# for c
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ class Machine(minerva.Remote):
|
||||||
public = True,
|
public = True,
|
||||||
disk_size = 8):
|
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)
|
super().__init__(None, username, key_pair[1], name)
|
||||||
|
|
||||||
self.pier = pier
|
self.pier = pier
|
||||||
|
|
@ -50,7 +54,7 @@ class Machine(minerva.Remote):
|
||||||
res = self.pier.ec2.run_instances(
|
res = self.pier.ec2.run_instances(
|
||||||
ImageId = self.ami,
|
ImageId = self.ami,
|
||||||
InstanceType = self.instance_type,
|
InstanceType = self.instance_type,
|
||||||
KeyName = self.key_pair[0] or self.pier.key_pair_name,
|
KeyName = self.key_pair[0],
|
||||||
MinCount = 1,
|
MinCount = 1,
|
||||||
MaxCount = 1,
|
MaxCount = 1,
|
||||||
TagSpecifications = [{'ResourceType': 'instance',
|
TagSpecifications = [{'ResourceType': 'instance',
|
||||||
|
|
@ -127,6 +131,7 @@ class Machine(minerva.Remote):
|
||||||
self.public_ip = self.description['PublicIpAddress']
|
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(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.ip = self.public_ip or self.private_ip
|
||||||
self.ssh = Connection(self.ip,
|
self.ssh = Connection(self.ip,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue