import os
from configurations.constants import *
from services.job_service import *

from apscheduler.schedulers.background import BlockingScheduler

scheduler = BlockingScheduler()

# @scheduler.scheduled_job('cron', day_of_week=os.environ.get('G_DAY'), hour=os.environ.get('G_HOUR'), minute=os.environ.get('G_MINUTE'), id='01', name=JOB['GENERATE']['SOCIAL_INTEREST_SIMILARITY'])
# def social_interest_similarity_job_with_lcn():
# 	params = {
# 		'location': True,
# 		'chapter': True,
# 		'nationality': True
# 	}
# 	try:
# 		print "social_interest_similarity_job_with_lcn is running."
# 		g_social_interest_similarity_job(params)
# 	except:
# 		print "social_interest_similarity_job_with_lcn is failed!"


@scheduler.scheduled_job('cron', day_of_week=os.environ.get('G_DAY'), hour=os.environ.get('G_HOUR'), minute=os.environ.get('G_MINUTE'), id='02', name=JOB['GENERATE']['SOCIAL_INTEREST_SIMILARITY'])
def mutual_friend_job_with_lcn():
	params = {
		'location': True,
		'chapter': True,
		'nationality': True
	}
	try:
		print "mutual_friend_job_with_lcn is running."
		g_mutual_friends_job(params)
	except:
		print "mutual_friend_job_with_lcn is failed!"


# @scheduler.scheduled_job('cron', day_of_week=os.environ.get('R_DAY'), hour=os.environ.get('R_HOUR'), minute=os.environ.get('R_MINUTE'), id='11', name=JOB['RETRIEVE']['SOCIAL_INTEREST_SIMILARITY'])
# def interest_similarity_sqs_job():
# 	try:
# 		print "interest_similarity_sqs_job is running."
# 		r_interest_similarity_job()
# 	except:
# 		print "interest_similarity_sqs_job is failed!"

@scheduler.scheduled_job('cron', day_of_week=os.environ.get('R_DAY'), hour=os.environ.get('R_HOUR'), minute=os.environ.get('R_MINUTE'), id='12', name=JOB['RETRIEVE']['SOCIAL_INTEREST_SIMILARITY'])
def mutual_friend_sqs_job():
	try:
		print "mutual_friend_sqs_job is running."
		r_mutual_friend_job()
	except:
		print "mutual_friend_sqs_job is failed!"



scheduler.start()
@@ -176,18 +176,16 @@
 uler()%0A%0A
-# 
 @schedul
@@ -369,26 +369,24 @@
 MILARITY'%5D)%0A
-# 
 def social_i
@@ -420,18 +420,16 @@
 _lcn():%0A
-# 
 %09params 
@@ -432,18 +432,16 @@
 ams = %7B%0A
-# 
 %09%09'locat
@@ -452,18 +452,16 @@
 : True,%0A
-# 
 %09%09'chapt
@@ -471,18 +471,16 @@
 : True,%0A
-# 
 %09%09'natio
@@ -497,23 +497,17 @@
 rue%0A
-# 
 %09%7D%0A
-# 
 %09try:%0A
-# 
 %09%09pr
@@ -564,18 +564,16 @@
 nning.%22%0A
-# 
 %09%09g_soci
@@ -607,18 +607,16 @@
 params)%0A
-# 
 %09except:
@@ -608,34 +608,32 @@
 arams)%0A%09except:%0A
-# 
 %09%09print %22social_
@@ -679,16 +679,18 @@
 led!%22%0A%0A%0A
+# 
 @schedul
@@ -870,32 +870,34 @@
 T_SIMILARITY'%5D)%0A
+# 
 def mutual_frien
@@ -906,32 +906,34 @@
 job_with_lcn():%0A
+# 
 %09params = %7B%0A%09%09'l
@@ -920,32 +920,34 @@
 :%0A# %09params = %7B%0A
+# 
 %09%09'location': Tr
@@ -942,32 +942,34 @@
 ocation': True,%0A
+# 
 %09%09'chapter': Tru
@@ -963,32 +963,34 @@
 chapter': True,%0A
+# 
 %09%09'nationality':
@@ -991,33 +991,39 @@
 lity': True%0A
+# 
 %09%7D%0A
+# 
 %09try:%0A
+# 
 %09%09print %22mut
@@ -1055,24 +1055,26 @@
 s running.%22%0A
+# 
 %09%09g_mutual_f
@@ -1084,32 +1084,34 @@
 nds_job(params)%0A
+# 
 %09except:%0A%09%09print
@@ -1095,32 +1095,34 @@
 ams)%0A# %09except:%0A
+# 
 %09%09print %22mutual_
@@ -1546,16 +1546,18 @@
 iled!%22%0A%0A
+# 
 @schedul
@@ -1741,24 +1741,26 @@
 MILARITY'%5D)%0A
+# 
 def mutual_f
@@ -1776,22 +1776,26 @@
 _job():%0A
+# 
 %09try:%0A
+# 
 %09%09print 
@@ -1830,16 +1830,18 @@
 nning.%22%0A
+# 
 %09%09r_mutu
@@ -1856,16 +1856,18 @@
 d_job()%0A
+# 
 %09except:
@@ -1859,32 +1859,34 @@
 ob()%0A# %09except:%0A
+# 
 %09%09print %22mutual_

change for testing