Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(11)  |  Call(0)  |  Derive(0)  |  Import(11)

src/s/n/sneakernet-HEAD/appengine/run.py   sneakernet(Download)
def team_caches(u):
    from cache import CacheLocation, TYPE_LOCAL_FD, TYPE_EXTERN_FD, is_cache_available_now, Cache
    locs = CacheLocation.all().filter("team_responsible =",u.team).filter("type =",TYPE_LOCAL_FD).fetch(limit=1000)
    locs += CacheLocation.all().filter("team_responsible =",u.team).filter("type =",TYPE_EXTERN_FD).fetch(limit=1000)
    caches = []
def find_a_cache_to_get(u):
    #we should prioritize in terms of what gets things off the network the fastest
    from cache import TYPE_EXTERN_FD, TYPE_LOCAL_FD, TYPE_EXTERNAL_RING, is_cache_available_now, ContentCopy, Cache
    from request import RequestCopy
    teamcaches = team_caches(u)
    externs = filter(lambda x: x.type==TYPE_EXTERN_FD,teamcaches)
            #figure out where to get that file
            #get all the external ring drives
            ringdrives = Cache.all().filter("type =",TYPE_EXTERN_FD)
            ringdrives = filter(is_cache_available_now,ringdrives)
            for drive in ringdrives:
    def fulfill(self,cache):
        from request import RequestCopy
        from cache import TYPE_EXTERN_FD, ContentCopy, get_copy
        fulfill_swap_requests = RequestCopy.all().filter("dest =",cache.permanent_location.team_responsible).filter("dest_int =",TYPE_EXTERN_FD).fetch(limit=1000)
        for request in fulfill_swap_requests:

src/s/n/sneakernet-HEAD/appengine/cachetalk.py   sneakernet(Download)
  def post(self):
    from user_sn import confirm
    from cache import can_operate_on, get_copy, ContentCopy, get_cache_by_name, TYPE_COMPUTER, TYPE_EXTERN_FD, TYPE_LOCAL_FD, TYPE_EXTERNAL_RING
    from Content import content_by_id
    u = confirm(self)
        elif c.type==TYPE_LOCAL_FD:
            rcs = rcs.filter("dest =",c.permanent_location.team_responsible).filter("dest_int =",TYPE_LOCAL_FD).fetch(limit=1000)
        elif c.type==TYPE_EXTERN_FD:
            #the common case (closing the RC associated with a swap) is handled in runComplete.
            rcs = RequestCopy.all().filter("file =",content).filter("dest_int =",TYPE_EXTERNAL_RING).fetch(limit=1000)

src/s/n/sneakernet-HEAD/appengine/request.py   sneakernet(Download)
def get_from_ext_cache(request,allcopies):
    logging.info("Searching (our) external cache...")
    from cache import TYPE_EXTERN_FD, is_cache_available_soon
    for copy in allcopies:
        if copy.where.type==TYPE_EXTERN_FD and copy.where.permanent_location.team_responsible.key() == request.user.team.key() and is_cache_available_soon(copy.where):
def get_from_any_ext_cache(request,allcopies):
    logging.info("Searching all external caches...")
    from cache import TYPE_EXTERN_FD, is_cache_available_soon
    for copy in allcopies:
        if copy.where.type==TYPE_EXTERN_FD and is_cache_available_soon(copy.where):
                from random import choice
                flag_leader = choice(leaders)
                rc = RequestCopy(file = request.file,req=request,dest=dest,dest_int = TYPE_EXTERN_FD,emailed_user=flag_leader)
                rc.put()
                send_run_msg(flag_leader)

src/s/n/sneakernet-HEAD/appengine/teamadmin.py   sneakernet(Download)
  def get(self):
    #get the whole team's caches
    from cache import CacheLocation, Cache, TYPE_LOCAL_FD, TYPE_EXTERN_FD
    from team import get_team_for_team_leader
    from user_sn import confirm
        if location.type == TYPE_LOCAL_FD:
            r = "INTERN"
        elif location.type == TYPE_EXTERN_FD:
            r = "EXTERN"
        logging.info("Writing info for location %s" % location)
  def post(self):
    from cache import CacheLocation, TYPE_LOCAL_FD, TYPE_EXTERN_FD
    from user_sn import confirm
    from team import get_team_for_team_leader
    u = confirm(self)
        cl.type=TYPE_LOCAL_FD
    elif self.request.get("cache-type")=="EXTERN":
        cl.type = TYPE_EXTERN_FD
    else:
        raise Exception("I don't know the type.")
    def post(self):
        from user_sn import confirm
        from team import get_team_for_team_leader
        from cache import TYPE_EXTERN_FD, TYPE_LOCAL_FD
        u = confirm(self)

src/s/n/sneakernet-HEAD/appengine/purge.py   sneakernet(Download)
def team_of(contentcopy):
    from cache import TYPE_EXTERN_FD, TYPE_LOCAL_FD
    if contentcopy.where.type==TYPE_LOCAL_FD or contentcopy.where.type == TYPE_EXTERN_FD:
        return contentcopy.where.permanent_location.team_responsible
    else: