Skip to content

Instantly share code, notes, and snippets.

<?php
require 'vendor/autoload.php';
require 'aws/aws-sdk-php';
?>
----------------
2017/03/14 04:26:00 [error] 18760#0: *3204778 FastCGI sent in stderr: "PHP message: PHP Warning: require(aws/aws-sdk-php): failed to open stream: No such file or directory in /var/www/basic/ipn.php on line 3
PHP message: PHP Fatal error: require(): Failed opening required 'aws/aws-sdk-php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/basic/ipn.php on line 3" while reading response header from upstream, client: 10.10.10.36, server: basic.ibbchina.com, request: "GET /ipn.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "basic.ibbcloud.com"
import os
import time
def is_process_running(process_id):
try:
os.kill(5475, 0)
return True
except OSError:
return False
def check_mysql_user(self, user, password, host=None):
print '\nverifying password of user %s ... ' % user,
kwargs = dict(host=host or self.mysql_host,
port=self.mysql_port,
user=user,
passwd=password)
try:
conn = MySQLdb.connect(**kwargs)
except Exception, e:
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
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
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()
@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):
l = ['m4','r2','r3']
n = 7
print itertools.islice(itertools.cycle(l), n)
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
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)