Skip to content

Commit

Permalink
Merge adfe464 into 564fec5
Browse files Browse the repository at this point in the history
  • Loading branch information
willronchetti committed May 27, 2020
2 parents 564fec5 + adfe464 commit 8c04952
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 23 deletions.
17 changes: 15 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def effectively_never():
return Cron('0', '0', '31', '2', '?', '?')


def end_of_day_on_weekdays():
""" Cron schedule that runs at 6pm EST on weekdays. Used for deployments. """
return Cron('0', '18', '*', '*', '1-5', '*')

# this dictionary defines the CRON schedules for the dev and prod foursight
# stagger them to reduce the load on Fourfront. Times are UTC
# info: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
Expand All @@ -34,7 +38,8 @@ def effectively_never():
'morning_checks_2': Cron('15', '10', '*', '*', '?', '*'),
'monday_checks': Cron('0', '9', '?', '*', '2', '*'),
'monthly_checks': Cron('0', '9', '1', '*', '?', '*'),
'manual_checks': effectively_never()
'manual_checks': effectively_never(),
'deployment_checks': end_of_day_on_weekdays()
},
'dev': {
'ten_min_checks': Cron('5/10', '*', '*', '*', '?', '*'),
Expand All @@ -46,7 +51,8 @@ def effectively_never():
'morning_checks_2': Cron('45', '10', '*', '*', '?', '*'),
'monday_checks': Cron('30', '9', '?', '*', '2', '*'),
'monthly_checks': Cron('30', '9', '1', '*', '?', '*'),
'manual_checks': effectively_never()
'manual_checks': effectively_never(),
'deployment_checks': end_of_day_on_weekdays() # disabled, see schedule below
}
}

Expand Down Expand Up @@ -96,6 +102,13 @@ def monthly_checks(event):
queue_scheduled_checks('all', 'monthly_checks')


@app.schedule(foursight_cron_by_schedule[STAGE]['deployment_checks'])
def deployment_checks(event):
if STAGE == 'dev':
return # do not schedule the deployment checks on dev
queue_scheduled_checks('all', 'deployment_checks')


'''######### END SCHEDULED FXNS #########'''


Expand Down
13 changes: 13 additions & 0 deletions chalicelib/check_setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,19 @@
}
}
},
"deploy_ff_staging": {
"title": "Deploy Fourfront master to staging.4dnucleome.org",
"group": "Deployment Checks",
"schedule": {
"deployment_checks": {
"data": {
"kwargs": {
"primary": true
}
}
}
}
},
"check_opf_lab_different_than_experiment": {
"title": "Opf contributing lab",
"group": "Metadata checks",
Expand Down
19 changes: 16 additions & 3 deletions chalicelib/checks/deployment_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from ..run_result import CheckResult, ActionResult
from ..utils import check_function, action_function
from dcicutils.deployment_utils import EBDeployer
from dcicutils.beanstalk_utils import compute_ff_stg_env
from dcicutils.env_utils import (
FF_ENV_INDEXER, CGAP_ENV_INDEXER, is_fourfront_env, is_cgap_env
FF_ENV_INDEXER, CGAP_ENV_INDEXER, is_fourfront_env, is_cgap_env,

)
from dcicutils.beanstalk_utils import compute_ff_prd_env
from dcicutils.beanstalk_utils import beanstalk_info, is_indexing_finished


Expand Down Expand Up @@ -164,8 +167,8 @@ def deploy_application_to_beanstalk(connection, **kwargs):
if application_version_name is None: # if not specified, use branch+timestamp
application_version_name = 'foursight-package-%s-%s' % (branch, datetime.datetime.utcnow())

if repo is not None:
repo_location = clone_repo_to_temporary_dir(repo)
if repo is not None: # NOTE: if you specify this, assume a CGAP deployment
repo_location = clone_repo_to_temporary_dir(repo, name='cgap-portal')
else:
repo_location = clone_repo_to_temporary_dir()

Expand All @@ -191,3 +194,13 @@ def deploy_application_to_beanstalk(connection, **kwargs):
cleanup_tempdir(repo_location)

return check


@check_function()
def deploy_ff_staging(connection, **kwargs):
""" Deploys Fourfront master to whoever staging is.
Runs as part of the 'deployment_checks' schedule on data ONLY.
"""
return deploy_application_to_beanstalk(connection,
env=compute_ff_stg_env(),
branch='master')
34 changes: 17 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = [

[tool.poetry.dependencies]
python = ">=3.6,<3.7"
dcicutils = "^0.28.2"
dcicutils = "^0.31.1"
click = "6.7"
PyJWT = "1.5.3"
Jinja2 = "2.10.1"
Expand Down

0 comments on commit 8c04952

Please sign in to comment.