예제 #1
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("foursquare.connect", None))
         if not s:
             print "Another instance is running"
         from fsq.utils import connect_uids
         connect_uids(**options)
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #2
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("foursquare.connect", None))
         if not s:
             print "Another instance is running"
         from fsq.utils import connect_uids
         connect_uids(**options)
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #3
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("registration.deactivate_accounts", None))
         if not s:
             print "Another instance is running"
         print "Account deactivation started"
         from registration.models import UserProfile
         num = UserProfile.objects.deactivate_accounts()
         print "Account deactivation done. Number of accounts deactivated:", num
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #4
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.autoprofiles", None))
         if not s:
             print "Another instance is running"
         print "Auto profile builder started"
         from event.import_utils import make_autoprofiles
         make_autoprofiles(**options)
         print "Auto profiles done"
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #5
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.do_fsq_venues", None))
         if not s:
             print "Another instance of event.do_fsq_venues is running"
             return
         from event.utils import do_foursquare_venues
         num, err = do_foursquare_venues()
         if num or err:
             print "Processed %s fsq venues with %s errors" % (num, err)
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #6
0
 def handle(self, filepath, metapath, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.import", None))
         if not s:
             print "Another instance is running"
         print "Import started from", filepath, metapath
         from event.import_utils import import_mlb as do_mlb
         print options
         do_mlb(filepath, metapath, **options)
         print "Import done"
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #7
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.eventcreatedsignals", None))
         if not s:
             print "Another instance of event.eventcreatedsignals is running"
             return
         from event.utils import process_event_created_signals
         num = process_event_created_signals()
         if num:
             print "event.eventcreatedsignals done. Processed %s events" % num
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #8
0
 def handle(self, filepath, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.import", None))
         if not s:
             print "Another instance is running"
         print "Import started from", filepath
         from event.import_utils import import_events
         print options
         import_events(filepath, **options)
         print "Import done"
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #9
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.do_fsq_venues", None))
         if not s:
             print "Another instance of event.do_fsq_venues is running"
             return
         from event.utils import do_foursquare_venues
         num, err = do_foursquare_venues()
         if num or err:
             print "Processed %s fsq venues with %s errors" % (num, err)
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #10
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(
             _TASK_LOCK_PORT.get("registration.deactivate_accounts", None))
         if not s:
             print "Another instance is running"
         print "Account deactivation started"
         from registration.models import UserProfile
         num = UserProfile.objects.deactivate_accounts()
         print "Account deactivation done. Number of accounts deactivated:", num
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #11
0
 def handle(self, *args, **options):
     try:
         s = lock_socket(_TASK_LOCK_PORT.get("event.cleanup", None))
         if not s:
             print "Another instance is running"
         print "Clean up started"
         from event.utils import cleanup
         from queue.models import ActionItem
         cleanup()
         ActionItem.objects.filter(status='done').delete()
         print "Clean up done"
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)
예제 #12
0
파일: task.py 프로젝트: kabirh/riotvine
 def handle(self, task_name=None, *args, **options):
     try:
         if not task_name:
             raise CommandError('Usage is %s' % self.args)
         mod, task = task_name.split('.')
         mod = '%s.amqp.tasks' % mod
         tasks = __import__(mod, globals(), locals(), [''])
         s = lock_socket(_TASK_LOCK_PORT.get(task_name, None))
         if not s:
             print "Another instance is running"
         fn = getattr(tasks, task)
         fn()
         time.sleep(3) # give the task a chance to get flushed
         print "Task initiated"
     except (KeyboardInterrupt, SystemExit):
         pass
     except Exception, e:
         print >> sys.stderr, "ERROR: %s" % e
         _x.exception(e)