Project

General

Profile

Revision 704

Don't set value of lease.price unless the lease is accepted.

View differences:

lease_scheduler.py
567 567
        ## that incorporates pricing in simulations (but not interactively yet)
568 568
        
569 569
        # Call pricing policy
570
        lease.price = get_policy().price_lease(lease, preemptions)
570
        lease_price = get_policy().price_lease(lease, preemptions)
571 571
        
572 572
        # Determine whether to accept price or not (this in particular
573 573
        # should happen in the lease admission step)
......
575 575
            markup = float(lease.extras["simul_pricemarkup"])
576 576
            if get_config().get("policy.pricing") != "free":
577 577
                fair_price = get_policy().pricing.get_fair_price(lease)
578
                if lease.price > fair_price * markup:
579
                    raise NotSchedulableException, "Lease priced at %.2f. User is only willing to pay %.2f" % (lease.price, fair_price * markup)
578
                if lease_price > fair_price * markup:
579
                    lease.price = -1
580
                    raise NotSchedulableException, "Lease priced at %.2f. User is only willing to pay %.2f" % (lease_price, fair_price * markup)
581
                else:
582
                    lease.price = lease_price
583
                    lease.extras["fair_price"] = fair_price
580 584
        
581 585
        ## END NOT-FIT-FOR-PRODUCTION CODE
582 586
                                

Also available in: Unified diff