Changeset 2589190 in rattail-fabric2


Ignore:
Timestamp:
11/20/2022 08:03:28 PM (2 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
4c8e956
Parents:
a36ecdb
git-author:
Lance Edgar <lance@…> (11/20/2022 08:02:48 PM)
git-committer:
Lance Edgar <lance@…> (11/20/2022 08:03:28 PM)
Message:

Make each overnight script optional

trying to phase out at least 1, maybe 2 of them...

this also cleans up the 'restart' script to use 'rattail overnight'
per recent changes. this seems the most useful to have around, in
case of web app failure

Location:
rattail_fabric2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rattail_fabric2/deploy/luigi/cron-overnight.sh.mako

    ra36ecdb r2589190  
    11#!/bin/sh -e
    2 <%text>############################################################</%text>
    3 #
    4 # overnight automation (${automation}) via cron
    5 #
    6 <%text>############################################################</%text>
    7 
    82
    93cd ${envroot}
     
    137$RATTAIL overnight ${automation.lower()} <%text>\</%text>
    148        --no-versioning <%text>\</%text>
    15          % if email_key is not Undefined and email_key:
    16          --email-key '${email_key}' <%text>\</%text>
    17          % endif
    18         --no-email-if-empty
     9        % if email_key is not Undefined and email_key:
     10        --email-key '${email_key}' <%text>\</%text>
     11        % endif
     12        --no-email-if-empty <%text>\</%text>
     13        --wait
  • rattail_fabric2/deploy/luigi/restart-overnight.sh.mako

    ra36ecdb r2589190  
    11#!/bin/sh -e
    22
    3 DATE=`date --date='yesterday' +%Y-%m-%d`
     3cd ${envroot}
    44
    5 echo "${envroot}/bin/rattail -c ${appdir}/cron.conf --no-versioning run-n-mail ${"--key '{}'".format(email_key) if email_key is not Undefined and email_key else ''} -S 'Overnight catch-up: ${automation}' '${appdir}/overnight-${automation.lower()}.sh $DATE'" | at 'now + 1 minute'
     5RATTAIL="bin/rattail --config=app/cron.conf"
     6
     7$RATTAIL overnight ${automation.lower()} <%text>\</%text>
     8        --no-versioning <%text>\</%text>
     9        % if email_key is not Undefined and email_key:
     10        --email-key '${email_key}' <%text>\</%text>
     11        % endif
     12        --email-if-empty <%text>\</%text>
     13        --no-wait
  • rattail_fabric2/luigi.py

    ra36ecdb r2589190  
    7474
    7575def install_overnight_script(c, envroot, user='rattail', automation='All',
    76                              email_key=None):
     76                             email_key=None,
     77                             luigi=True, cron=True, restart=True):
    7778    """
    7879    Install an overnight automation script
     
    8283
    8384    # overnight-*.sh
    84     filename = 'overnight-{}.sh'.format(automation.lower())
    85     deploy_common(c, 'luigi/overnight.sh.mako',
    86                   '{}/{}'.format(appdir, filename),
    87                   use_sudo=True, owner=user, mode='0755',
    88                   context={'envroot': envroot, 'appdir': appdir,
    89                            'automation': automation})
     85    if luigi:
     86        filename = 'overnight-{}.sh'.format(automation.lower())
     87        deploy_common(c, 'luigi/overnight.sh.mako',
     88                      '{}/{}'.format(appdir, filename),
     89                      use_sudo=True, owner=user, mode='0755',
     90                      context={'envroot': envroot, 'appdir': appdir,
     91                               'automation': automation})
    9092
    9193    # cron-overnight-*.sh
    92     filename = 'cron-overnight-{}.sh'.format(automation.lower())
    93     deploy_common(c, 'luigi/cron-overnight.sh.mako',
    94                   '{}/{}'.format(appdir, filename),
    95                   use_sudo=True, owner=user, mode='0755',
    96                   context={'envroot': envroot,
    97                            'automation': automation,
    98                            'email_key': email_key})
     94    if cron:
     95        filename = 'cron-overnight-{}.sh'.format(automation.lower())
     96        deploy_common(c, 'luigi/cron-overnight.sh.mako',
     97                      '{}/{}'.format(appdir, filename),
     98                      use_sudo=True, owner=user, mode='0755',
     99                      context={'envroot': envroot,
     100                               'automation': automation,
     101                               'email_key': email_key})
    99102
    100103    # restart-overnight-*.sh
    101     filename = 'restart-overnight-{}.sh'.format(automation.lower())
    102     deploy_common(c, 'luigi/restart-overnight.sh.mako',
    103                   '{}/{}'.format(appdir, filename),
    104                   use_sudo=True, owner=user, mode='0755',
    105                   context={'envroot': envroot,
    106                            'appdir': appdir,
    107                            'automation': automation,
    108                            'email_key': email_key})
     104    if restart:
     105        filename = 'restart-overnight-{}.sh'.format(automation.lower())
     106        deploy_common(c, 'luigi/restart-overnight.sh.mako',
     107                      '{}/{}'.format(appdir, filename),
     108                      use_sudo=True, owner=user, mode='0755',
     109                      context={'envroot': envroot,
     110                               'appdir': appdir,
     111                               'automation': automation,
     112                               'email_key': email_key})
    109113
    110114
Note: See TracChangeset for help on using the changeset viewer.