This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev_sda1 = boto.ec2.blockdevicemapping.EBSBlockDeviceType() | |
dev_sda1.size = 25 | |
bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping() | |
bdm['/dev/sda1'] = dev_sda1 | |
req = conn.request_spot_instances(price=max_bid,image_id='ami-ea26f684',instance_type=servtype[cnt],key_name=key,availability_zone_group='ap-northeast-2',network_interfaces=interfaces,user_data=ud,block_device_map = [bdm])[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: Traceback (most recent call last): | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1749, in run | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: self._check_banner() | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1897, in _check_banner | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: raise SSHException('Error reading SSH protocol banner' + str(e)) | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: SSHException: Error reading SSH protocol banner | |
ERR [20170407-19:12:19.894] thr=134 paramiko.transport: | |
DEB [20170407-19:12:22.458] thr=3 paramiko.transport: Received global request "[email protected]" | |
DEB [20170407-19:12:22.458] thr=3 paramiko.transport: Rejecting "[email protected]" global request from server. | |
----------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def readlog(): | |
log = open('./seaflog') | |
loglines = log.read() | |
for line in loglines: | |
print line.split() | |
OUTPUT: | |
['t'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getprice(instlist): | |
print instlist | |
pdb.set_trace() | |
for idx, inst in enumerate(instlist): | |
price_history = conn.get_spot_price_history(instance_type = inst, product_description = 'Linux/UNIX', max_results=10, availability_zone=az) | |
price = float(str(price_history[0]).split(':')[1]) / max_bid | |
print price_history[0] | |
#pdb.set_trace() | |
if price > 0.9: | |
instlist.pop(idx) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getprice(instlist,price_history): | |
for idx, inst in enumerate(instlist): | |
price = float(str(price_history[0]).split(':')[1]) / max_bid | |
print price_history[0] | |
if price > 0.9: | |
pdb.set_trace() | |
del(instlist[idx]) | |
return instlist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = ['m4','r2','r3'] | |
n = 7 | |
print itertools.islice(itertools.cycle(l), n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@click.command() | |
@click.option('--action',required=True) | |
@click.option('--platform','-p',default='test') | |
@click.option('--version','-v',default=0) | |
@click.option('--domain','-d') | |
@click.option('--rebuild','-r',is_flag=True) | |
....... | |
def main(action): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='Manually intervene in the Core Seafile Cluster') | |
parser.add_argument('action', help='Actions: list, create, kill') | |
parser.add_argument('platform', nargs='?', default="test") | |
parser.add_argument('version', nargs='?', default="0") | |
parser.add_argument('--domain') | |
parser.add_argument('--rebuild') | |
args = parser.parse_args() | |
x = ClusterSystem() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdb.set_trace() | |
if rebuild == 1: | |
pdb.set_trace() | |
move_and_mount(sname,"seafile-data",ms) | |
--- TRACE | |
> /root/cluster/systems.py(82)start_seafile_container() | |
-> if rebuild == 1: | |
(Pdb) print rebuild | |
1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip-10-10-1-78 ~ # docker ps --all | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
12713506ddb2 10.10.1.64:5000/ibb/nginx "--name test" 9 minutes ago Created boring_euclid | |
f5c68e956ba8 10.10.1.64:5000/ibb/seafile "/opt/start.sh setup" 19 minutes ago Exited (0) 54 seconds ago test205 | |
51fe9ac370af 10.10.1.64:5000/ibb/seafile "/opt/start.sh setup" 39 minutes ago Exited (0) 54 seconds ago test204 | |
4b7f804632b0 10.10.1.64:5000/ibb/seafile "/opt/start.sh setup" 40 minutes ago Exited (0) 54 seconds ago test203 | |
4ed4dfbbf031 10.10.1.64:5000/ibb/nginx "nginx -g 'daemon off" 53 minutes ago Exited (0) 55 seconds ago nginx |