Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
11645da6
Commit
11645da6
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
cron job for refreshing redcap data
parent
ecd88318
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!65
Simple connection to RED Cap
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/smash/settings.py
+2
-1
2 additions, 1 deletion
smash/smash/settings.py
smash/web/redcap_connector.py
+19
-0
19 additions, 0 deletions
smash/web/redcap_connector.py
with
21 additions
and
1 deletion
smash/smash/settings.py
+
2
−
1
View file @
11645da6
...
...
@@ -71,7 +71,8 @@ TEMPLATES = [
]
CRON_CLASSES
=
[
'
web.views.kit.KitRequestEmailSendJob
'
'
web.views.kit.KitRequestEmailSendJob
'
,
'
web.redcap_connector.RedCapRefreshJob
'
]
# Password validation
...
...
This diff is collapsed.
Click to expand it.
smash/web/redcap_connector.py
+
19
−
0
View file @
11645da6
...
...
@@ -5,6 +5,7 @@ import logging
import
pycurl
import
certifi
from
django_cron
import
CronJobBase
,
Schedule
from
web.models
import
ConfigurationItem
,
Subject
,
Language
from
web.models.constants
import
REDCAP_TOKEN_CONFIGURATION_TYPE
,
\
...
...
@@ -302,3 +303,21 @@ class RedcapConnector(object):
return
False
return
True
class
RedCapRefreshJob
(
CronJobBase
):
RUN_EVERY_MINUTES
=
60
schedule
=
Schedule
(
run_every_mins
=
RUN_EVERY_MINUTES
)
code
=
'
web.red_cap_hourly_refresh
'
# a unique code
def
do
(
self
):
connector
=
RedcapConnector
()
if
connector
.
is_valid
():
logger
.
info
(
"
Refreshing redcap data
"
)
connector
.
refresh_inconsistent
()
connector
.
refresh_missing
()
logger
.
info
(
"
Redcap data refreshed
"
)
return
"
ok
"
else
:
logger
.
info
(
"
Redcap connector is down
"
)
return
"
connector down
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment