Exemplo n.º 1
0
 def connect_fps(self,
                 aws_access_key_id=None,
                 aws_secret_access_key=None,
                 **kwargs):
     if aws_access_key_id == None:
         aws_access_key_id = self.config.get("Credentials",
                                             "aws_access_key_id")
     if aws_secret_access_key == None:
         aws_secret_access_key = self.config.get("Credentials",
                                                 "aws_secret_access_key")
     return boto.connect_fps(aws_access_key_id, aws_secret_access_key,
                             **kwargs)
Exemplo n.º 2
0
def getbotofps(use_sandbox=True):

    if use_sandbox:
        hostname = 'fps.sandbox.amazonaws.com'
    else:
        hostname = "fps.amazonaws.com"

    try:
        fpsconn = boto.connect_fps(debug=2,
                                   host=hostname)
    except boto.exception.NoAuthHandlerFound, e:
        return None
Exemplo n.º 3
0
def estimate_costs(current_spot_price,new_total_spot,new_total_on_demand):
    '''
    Utility method.  Estimates how much the contest will cost, in total.
    '''
    spot_price = current_spot_price + m1medium_emr
    on_demand_price = m1medium_base + m1medium_emr
    now = datetime.datetime.now()
    future = now + datetime.timedelta(hours = 24)
    time_left = end_contest_datetime - now
    time_used = now - start_contest_datetime
    
    fps = boto.connect_fps(access_key, secret_key)
    account_balance = fps.get_account_balance() - offset_account_balance
    
    hourly_cost = account_balance / (time_used.hours * 1.0)
    
    remaining_cost = time_left.hours * (spot_price * new_total_spot + on_demand_price * new_total_on_demand)
    total_cost = remaining_cost + account_balance
    return remaining_cost,total_cost
Exemplo n.º 4
0
	def connect_fps(self, aws_access_key_id=None, aws_secret_access_key=None,**kwargs):
		if aws_access_key_id == None:
			aws_access_key_id = self.config.get("Credentials", "aws_access_key_id")
		if aws_secret_access_key == None:
			aws_secret_access_key = self.config.get("Credentials", "aws_secret_access_key")
		return boto.connect_fps(aws_access_key_id, aws_secret_access_key, **kwargs)