Skip to content

Commit

Permalink
Merge branch 'release/v17.12.21'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-c committed Dec 27, 2017
2 parents 3b2f6c2 + 10bdb80 commit fdad1c1
Show file tree
Hide file tree
Showing 133 changed files with 29,938 additions and 4,351 deletions.
22 changes: 15 additions & 7 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh -e

cmdname=$(basename $0)
cmdname="$(basename "$0")"

usage() {
cat << USAGE >&2
Expand All @@ -19,14 +19,18 @@ update_repo(){
git fetch origin
git fetch --tags

if [ "$BRANCH" != "$(git rev-parse --abbrev-ref HEAD)" ]; then
# Change current branch, if specified
if [ -n "$BRANCH" ] && [ "$BRANCH" != "$repo_branch" ]; then
echo "Switching current branch to $BRANCH"
git checkout "$BRANCH"
repo_branch="$BRANCH"
fi

git pull origin "$BRANCH"
git reset --hard "origin/$repo_branch"
}

repo_path=$( cd $(dirname $0) ; git rev-parse --show-toplevel )
repo_path="$(cd $(dirname $0) ; git rev-parse --show-toplevel)"
repo_branch="$(git rev-parse --abbrev-ref HEAD)"

while getopts ":b:p:" option; do
case "${option}" in
Expand All @@ -53,20 +57,24 @@ export GIT_DIR="${GIT_WORK_TREE}/.git"
export FLASK_APP="${GIT_WORK_TREE}/manage.py"

# Assign branch in the following precedence:
# BRANCH envvar, branch specified by option (-b), "develop"
BRANCH=${BRANCH:-${branch:-develop}}

# BRANCH envvar, branch specified by option (-b)
BRANCH="${BRANCH:-${branch}}"
update_repo

echo "Activating virtualenv"
. "${GIT_WORK_TREE}/env/bin/activate"

echo "Updating python dependancies"
cd "${GIT_WORK_TREE}"
# Do not pass GIT_WORK_TREE environment variable
# Dependencies installed in "editable mode" (-e) with git will not install correctly
env --unset GIT_WORK_TREE pip install --quiet --requirement requirements.txt

echo "Synchronizing database"
flask sync

echo "Downloading translations from Smartling"
flask translation_download

echo "Updating package metadata"
python setup.py egg_info --quiet
10 changes: 9 additions & 1 deletion instance/babel.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Babel configuration file
# http://babel.pocoo.org/en/latest

# Ignore developer-centric pages
# Paths are relative from portal/ directory
[ignore: templates/settings.html]
[ignore: templates/client*.html]
[ignore: templates/admin.html]

[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_

16 changes: 14 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,24 @@ def translation_upload():


@click.option('--language', '-l', help='language code (e.g. en_US).')
@click.option('--state', '-s', help='Translation state', type=click.Choice([
'pseudo',
'pending',
'published',
'contextMatchingInstrumented',
]))
@app.cli.command()
def translation_download(language):
def translation_download(language, state):
"""Download .po file(s) from Smartling
GETs the .po file for the specified language from Smartling via their API.
If no language is specified, all available translations will be downloaded.
After download, .po file(s) are compiled into .mo file(s) using pybabel
"""
smartling_download(language)

default_state = 'pending'
if app.config['SYSTEM_TYPE'].lower() == 'production':
default_state = 'published'
state = state or default_state
click.echo('Downloading {state} translations from Smartling'.format(state=state))
smartling_download(state=state, language=language)
17 changes: 13 additions & 4 deletions portal/celery_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
celery = create_celery(app)
app.app_context().push()


@celery.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
"""Configure scheduled jobs in Celery"""
from .tasks import logger
logger.info("Starting ScheduledJob load...")
# create test task if non-existent
if not ScheduledJob.query.filter_by(name="__test_celery__").first():
test_job = ScheduledJob(name="__test_celery__", task="test",
Expand All @@ -33,11 +36,17 @@ def setup_periodic_tasks(sender, **kwargs):
test_job = db.session.merge(test_job)

# add all tasks to Celery
for job in ScheduledJob.query.filter_by(active=True):
logger.info("ScheduledJobs found: {}".format(ScheduledJob.query.count()))
for job in ScheduledJob.query.all():
task = getattr(tasks, job.task, None)
if task:
logger.info("Adding task (id=`{}`, task=`{}` "
"to CeleryBeat".format(job.id, job.task))
args_in = job.args.split(',') if job.args else []
kwargs_in = job.kwargs or {}
sender.add_periodic_task(job.crontab_schedule(),
task.s(job.id, *args_in,
**kwargs_in))
kwargs_in['job_id'] = job.id
try:
sender.add_periodic_task(job.crontab_schedule(),
task.s(*args_in, **kwargs_in))
except Exception as exc:
logger.error(exc)
30 changes: 24 additions & 6 deletions portal/config/eproms/Coding.json
Original file line number Diff line number Diff line change
Expand Up @@ -6048,12 +6048,6 @@
"resourceType": "Coding",
"system": "http://www.ichom.org/medical-conditions/localized-prostate-cancer/"
},
{
"code": "",
"display": "Default",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
},
{
"code": "en_AU",
"display": "Australian English",
Expand All @@ -6065,6 +6059,30 @@
"display": "American English",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
},
{
"code": "de_CH",
"display": "Swiss German",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
},
{
"code": "es_US",
"display": "American Spanish",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
},
{
"code": "fr_CA",
"display": "Canadian French",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
},
{
"code": "sv_SE",
"display": "Swedish",
"resourceType": "Coding",
"system": "urn:ietf:bcp:47"
}
],
"id": "SitePersistence v0.2",
Expand Down
12 changes: 6 additions & 6 deletions portal/config/eproms/CommunicationRequest.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
],
"lr_uuid": "b71dfdf6-bb19-3fff-84bd-4cdb30050499",
"notify_post_qb_start": "{\"days\": 0}",
"qb_iteration": 1,
"qb_iteration": 0,
"questionnaire_bank": {
"display": "IRONMAN_recurring_6mo_pattern",
"reference": "api/questionnaire_bank/IRONMAN_recurring_6mo_pattern"
Expand All @@ -424,7 +424,7 @@
],
"lr_uuid": "2c837970-71e3-d736-9d2f-626f417bbbad",
"notify_post_qb_start": "{\"weeks\": 1}",
"qb_iteration": 1,
"qb_iteration": 0,
"questionnaire_bank": {
"display": "IRONMAN_recurring_6mo_pattern",
"reference": "api/questionnaire_bank/IRONMAN_recurring_6mo_pattern"
Expand All @@ -442,7 +442,7 @@
],
"lr_uuid": "2c837970-71e3-d736-9d2f-626f417bbbad",
"notify_post_qb_start": "{\"weeks\": 2}",
"qb_iteration": 1,
"qb_iteration": 0,
"questionnaire_bank": {
"display": "IRONMAN_recurring_6mo_pattern",
"reference": "api/questionnaire_bank/IRONMAN_recurring_6mo_pattern"
Expand All @@ -460,7 +460,7 @@
],
"lr_uuid": "2c837970-71e3-d736-9d2f-626f417bbbad",
"notify_post_qb_start": "{\"weeks\": 3}",
"qb_iteration": 1,
"qb_iteration": 0,
"questionnaire_bank": {
"display": "IRONMAN_recurring_6mo_pattern",
"reference": "api/questionnaire_bank/IRONMAN_recurring_6mo_pattern"
Expand All @@ -478,7 +478,7 @@
],
"lr_uuid": "d9514c96-4769-993f-f6e4-03a67d8f7424",
"notify_post_qb_start": "{\"weeks\": 4}",
"qb_iteration": 1,
"qb_iteration": 0,
"questionnaire_bank": {
"display": "IRONMAN_recurring_6mo_pattern",
"reference": "api/questionnaire_bank/IRONMAN_recurring_6mo_pattern"
Expand All @@ -497,4 +497,4 @@
},
"resourceType": "Bundle",
"type": "document"
}
}
Loading

0 comments on commit fdad1c1

Please sign in to comment.