-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathjobs_defs.py
180 lines (149 loc) · 3.84 KB
/
jobs_defs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
from sqlalchemy import text
from sqlalchemy import orm
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.sql.expression import func
from app import db
import app
from jobs import update_registry
from jobs import Update
from models.product import Product
from models.person import Person
from models import person
q = db.session.query(Person.id)
q = q.filter(Person.orcid_id != None)
q = q.order_by(func.random())
update_registry.register(Update(
job=Person.refresh,
query=q,
queue_id=0
))
q = db.session.query(Person.id)
q = q.filter(Person.claimed_at != None)
update_registry.register(Update(
job=Person.email_new_stuff,
query=q,
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.calculate,
query=q,
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.call_oadoi,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.call_oadoi_on_everything,
query=q,
queue_id=0
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_from_orcid,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_fulltext_urls,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_mendeley,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_mendeley_sums,
query=q
))
q = db.session.query(Product.id)
q = q.filter(Product.altmetric_api_raw != None)
q = q.filter(Product.altmetric_api_raw != {})
q = q.filter(Product.event_dates == None)
update_registry.register(Update(
job=Product.set_event_dates,
query=q
))
q = db.session.query(Product.id)
q = q.filter(Product.altmetric_api_raw != None)
q = q.filter(Product.altmetric_score == None)
update_registry.register(Update(
job=Product.set_altmetric_score,
query=q
))
q = db.session.query(Product.id)
q = q.filter(Product.altmetric_api_raw != None)
update_registry.register(Update(
job=Product.set_altmetric_id,
query=q
))
q = db.session.query(Product.id)
q = q.filter(Product.post_counts != None)
q = q.filter(Product.post_counts != {})
update_registry.register(Update(
job=Product.set_post_details,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_post_details,
query=q
))
# q = db.session.query(Person.id)
# update_registry.register(Update(
# job=Person.email_new_badge,
# query=q
# ))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_coauthors,
query=q
))
q = db.session.query(Person.id)
q = q.filter(Person.twitter != None)
update_registry.register(Update(
job=Person.update_twitter_profile_data,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.run_log_openness,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.set_num_oa_licenses,
query=q
))
q = db.session.query(Person.id)
# q = q.filter(Person.orcid_id.in_([
# "0000-0002-6133-2581",
# "0000-0002-0159-2197",
# "0000-0003-1613-5981",
# "0000-0003-1419-2405",
# "0000-0001-6187-6610",
# "0000-0001-6728-7745"]))
update_registry.register(Update(
job=Person.set_badge_percentiles,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.assign_badges,
query=q,
shortcut_fn=lambda: ["open_license", "percent_fulltext", "all_fulltext"]
))
q = db.session.query(Person.id)
# q = q.filter(Person.updated < '2016-04-10 10:00:51.972209')
update_registry.register(Update(
job=Person.refresh_from_db,
query=q
))
q = db.session.query(Person.id)
update_registry.register(Update(
job=Person.all_products_set_biblio_from_orcid,
query=q
))