Ejemplo n.º 1
0
def addJunk(N=[1, 2, 3]):
    deleteJunk(backends.get_instance())
    q = Junk()
    q.count = backends.get_instance()
    q.txt = str('Count:' + str(tmp_count) + ' Instance:' +
                str(backends.get_instance()))
    q.put()
Ejemplo n.º 2
0
def _get_taskqueue_target():
    return '%d.%s' % (backends.get_instance(), backends.get_backend())
Ejemplo n.º 3
0
class RunTask(webapp.RequestHandler):
    def post(self):
        if backends.get_backend() != "queue-issue" and settings.GOOGLE_APP_ENGINE_LIVE:
            logging.warn("Only the queue-issue backend can call /run_task/")
            return

        return self.response.out.write("OK")
# }}}

# init application {{{
application = webapp.WSGIApplication([
    ('/run_task/', RunTask), # login: admin
    ('/enqueue_tasks/', EnqueueTasks), # login: admin
], debug=True)

def main():
    run_wsgi_app(application)
# }}}

# init the events-logger backend {{{
if backends.get_backend() == "queue-issue":
    tools.debug("%s-backend" % backends.get_backend(), "%s-backend-initiated" % backends.get_backend(), \
            {"instance_id": backends.get_instance(), 
                "backend_instance_url": backends.get_url(instance=backends.get_instance()),
                "backend_load_balancer_url": backends.get_url()
            })
# }}}

if __name__ == '__main__':
    main()
Ejemplo n.º 4
0
    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''

from google.appengine.api import apiproxy_stub_map
from google.appengine.api import backends
from google.appengine.api import runtime

import datetime
import logging

_NAME = '{}.{} {} ({})'.format(backends.get_backend(), backends.get_instance(),
                               backends.get_url(), datetime.datetime.now())


def my_shutdown_hook():
    logging.warning('{} SHUTDOWN HOOK CALLED'.format(_NAME))
    apiproxy_stub_map.apiproxy.CancelApiCalls()
    # save_state()
    # May want to raise an exception


# register our shutdown hook, which is not guaranteed to be called
logging.info('{} REGISTERING SHUTDOWN HOOK'.format(_NAME))
runtime.set_shutdown_hook(my_shutdown_hook)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''


from google.appengine.api import apiproxy_stub_map
from google.appengine.api import backends
from google.appengine.api import runtime

import datetime
import logging


_NAME = '{}.{} {} ({})'.format(backends.get_backend(),
                               backends.get_instance(),
                               backends.get_url(),
                               datetime.datetime.now())


def my_shutdown_hook():
  logging.warning('{} SHUTDOWN HOOK CALLED'.format(_NAME))
  apiproxy_stub_map.apiproxy.CancelApiCalls()
  # save_state()
  # May want to raise an exception

# register our shutdown hook, which is not guaranteed to be called
logging.info('{} REGISTERING SHUTDOWN HOOK'.format(_NAME))
runtime.set_shutdown_hook(my_shutdown_hook)
Ejemplo n.º 6
0
def main():
    log('v3')
    run_wsgi_app(application)
    stuff()
    addJunk()
    log('myFetch: ' + str(myFetch(backends.get_instance())))
Ejemplo n.º 7
0
	def get(self):
		return self.render('main/landing.html', title='Welcome - BSD App Tools', version=sys.version, sysconfig=config.config.get('bluestate.project'), appid=app_identity.get_application_id(), instanceid=backends.get_instance())
def _get_taskqueue_target():
    return '%d.%s' % (backends.get_instance(), backends.get_backend())
Ejemplo n.º 9
0
from google.appengine.api import backends
from google.appengine.api import runtime
from google.appengine.api import users

from google.appengine.ext import webapp

from google.appengine.ext.webapp import template

import cgi
import datetime
import logging
import os
import urllib


my_name = '%s.%s (%s)' % (backends.get_backend(), backends.get_instance(), backends.get_url())


logging.info(my_name + ' is registering shutdown hook')


def my_shutdown_hook():
  logging.warning('shutdown hook called')
  apiproxy_stub_map.apiproxy.CancelApiCalls()
  # save_state()
  # May want to raise an exception

# register our shutdown hook, which is not guaranteed to be called
runtime.set_shutdown_hook(my_shutdown_hook)

Ejemplo n.º 10
0
def main():
    log('v3')
    run_wsgi_app(application)
    stuff()
    addJunk()
    log('myFetch: '+str(myFetch(backends.get_instance())))
Ejemplo n.º 11
0
def addJunk(N=[1,2,3]):
    deleteJunk(backends.get_instance())
    q=Junk()
    q.count=backends.get_instance()
    q.txt=str('Count:'+str(tmp_count)+' Instance:'+str(backends.get_instance()) )
    q.put()