|
@@ -19,15 +19,18 @@ from click import Option
|
|
|
|
|
|
app = Celery('tasks', backend ='redis://172.104.92.245', broker='redis://172.104.92.245')
|
|
|
qname=None
|
|
|
-
|
|
|
-app.user_options['preload'].add(Option(('-Z', '--template'),
|
|
|
+custname=None
|
|
|
+app.user_options['preload'].add(Option(('-Z', '--cust'),
|
|
|
default='default',
|
|
|
help='Configuration template to use.'))
|
|
|
|
|
|
@signals.user_preload_options.connect
|
|
|
def on_preload_parsed(options, **kwargs):
|
|
|
- print(options['template'])
|
|
|
- print(options)
|
|
|
+ global custname
|
|
|
+# if options.get_key('template')
|
|
|
+ print(options['cust'])
|
|
|
+ custname=options['cust']
|
|
|
+# print(options)
|
|
|
|
|
|
|
|
|
@celeryd_init.connect
|
|
@@ -62,7 +65,7 @@ def configure_workers(sender=None, **kwargs):
|
|
|
|
|
|
@app.task()
|
|
|
def selenium_jared_click():
|
|
|
-
|
|
|
+ global custname
|
|
|
|
|
|
db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
|
|
|
options = webdriver.ChromeOptions()
|
|
@@ -87,8 +90,9 @@ def selenium_jared_click():
|
|
|
|
|
|
#kw='真理大學國際生'
|
|
|
#domain='cia.au.edu.tw'
|
|
|
-
|
|
|
- cursor=db.query("SELECT cust,plan,prefix,domain,kw,positive FROM public.seo_jobs where cust='真理' order by random() limit 1")
|
|
|
+ if custname is None:
|
|
|
+ custname='真理'
|
|
|
+ cursor=db.query("SELECT cust,plan,prefix,domain,kw,positive FROM public.seo_jobs where cust='"+custname+"' order by random() limit 1")
|
|
|
kw=None
|
|
|
domain=None
|
|
|
for c in cursor:
|