Daily cron start ends when maximum run time is exceeded

I don’t know why my cron runs for 20 minutes and it is completed. On descents, if you run cron, it will be killed in 5 minutes. If you run with nohup, he will be killed in 20 minutes.
This is my cron_daily error log. The file update_dave_listran for 20 minutes:

Thu Nov 19 03:08:08 EST 2015: START daily cron run
__________________________________________________________________________
/var/lib/openshift/55a000094/app-root/runtime/repo//.openshift/cron/daily/update_dave_list:
WARNING:py.warnings:/var/lib/openshift/55a0000094/python/virtenv/lib/python2.7/site-packages/django_crontab-0.6.0-py2.7.egg/django_crontab/crontab.py:13: RemovedInDjango19Warning: django.uti$
  from django.utils.importlib import import_module
/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh: line 114: 181616 Killed                  $executor "$SCRIPTS_DIR"
Warning: daily cron run terminated as it exceeded max run time
__________________________________________________________________________
Thu Nov 19 03:28:09 EST 2015: END daily cron run - status=137
__________________________________________________________________________

The problem is that it update_dave_listonly takes ~ 20 seconds to run: update_dave_listcontent:

#!/bin/bash
date
nohup /var/lib/openshift/55000094/python/virtenv/bin/python /var/lib/openshift/55000094/app-root/runtime/repo/wsgi/digrin/manage.py crontab run 18e10bf4fb745d8a480230a3 # update dave lists
date

exit:

Št nov 19 03:43:47 EST 2015
nohup: ignoring input and appending output to `nohup.out'
Št nov 19 03:44:05 EST 2015

The problem is also that not one of my other daily crowns starts if someone is killed. Oh, and here is the code if you are wondering what I am running in 20 seconds:

def update_dave_list():
    # if settings.ON_OPENSHIFT:
    response = urlopen("http://www.dripinvesting.org/tools/U.S.DividendChampions.xls")
    excell = xlrd.open_workbook(file_contents=response.read())
    for sheet in range(0,3): #for champions, challengers and contenders
        worksheet = excell.sheet_by_index(sheet)
        list, created = List.objects.get_or_create(name=worksheet.name, short_name=worksheet.name,
                                                   source="http://www.dripinvesting.org/tools/tools.asp")
        num_rows = worksheet.nrows - 1
        curr_row = 5
        symbol_list = []
        while curr_row < num_rows:
            curr_row += 1
            symbol = worksheet.cell(curr_row, 1)
            if symbol.ctype != 1: #break if you are out of symbol
                break
                #print  cell.value.replace(".", "-")
            symbol_list.append(unify_symbol(symbol.value))
            industry = worksheet.cell(curr_row, 2)
            sector = worksheet.cell(curr_row, 77)
            years = worksheet.cell(curr_row, 3)
            try:
                list_stock, created = ListStock.objects.get_or_create(stock=Stock.objects.get(symbol=unify_symbol(symbol.value)))
            except ObjectDoesNotExist:
                AddStock.objects.get_or_create(symbol=unify_symbol(symbol.value))
                continue
            list_stock.industry = industry.value
            list_stock.years_paying = years.value
            if sector.ctype == 1:
                if list_stock.stock.sector == None:
                    sector_obj, created = Sector.objects.get_or_create(name=sector.value)
                    list_stock.stock.sector = sector_obj
                    list_stock.stock.save()
            list_stock.save()
            #add stocks to list
            list.stocks.add(list_stock)
        #delete removed stocks
        for list_stock in list.stocks.all():
            if list_stock.stock.symbol not in symbol_list:
                list.stocks.remove(list_stock)
    return

, , , cron (./update_dave_list), 20 , cron, . , ?


EDIT1: update_dave_list :

#!/bin/bash
#/var/lib/openshift/55a0310e4382ec4b84000094/python/virtenv/bin/python /var/lib/openshift/55a0310e4382ec4b84000094/app-root/runtime/repo/wsgi/digrin/manage.py crontab run 18e10bf4fb92741b69745d8a480230a3 # update dave lists

cron openshift :

drwx------. 2 55a00094 55a00094 4096 nov 22 17:55 .
drwx------. 7 55a00094 55a00094 4096 nov 22 17:39 ..
-rw-------. 1 55a00094 55a00094    0 nov 22 17:37 .gitignore
-rwxr-xr-x. 1 55a00094 55a00094  236 nov 22 17:37 update_dave_list
-rwxr-xr-x. 1 55a00094 55a00094  235 nov 22 17:37 update_dgr
-rwxr-xr-x. 1 55a00094 55a00094  244 nov 22 17:37 update_ex_dividends
-rwxr-xr-x. 1 55a00094 55a00094  250 nov 22 17:37 update_frequency
-rwxr-xr-x. 1 55a00094 55a00094  236 nov 22 17:37 update_industry
-rwxr-xr-x. 1 55a00094 55a00094  472 nov 22 17:37 update_stocks
-rwxr-xr-x. 1 55a00094 55a00094  243 nov 22 17:37 update_years_paying
-rwxr-xr-x. 1 55a00094 55a00094  252 nov 22 17:37 watcher

dave, cron_daily.log:

__________________________________________________________________________
Mon Nov 23 03:25:54 EST 2015: START daily cron run
__________________________________________________________________________
/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh: line 114: 28445 Killed                  $executor "$SCRIPTS_DIR"
Warning: daily cron run terminated as it exceeded max run time
__________________________________________________________________________
Mon Nov 23 03:45:54 EST 2015: END daily cron run - status=137
__________________________________________________________________________

, , , - cron_runjobs.sh. openshift, ( ). , , cron.


EDIT2: cron:

rhc cartridge remove cron -a <app>
rhc cartridge add cron -a <app>

:

__________________________________________________________________________
Tue Nov 24 03:12:47 EST 2015: START daily cron run
__________________________________________________________________________
/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh: line 114: 211644 Killed                  $executor "$SCRIPTS_DIR"
Warning: daily cron run terminated as it exceeded max run time
__________________________________________________________________________
Tue Nov 24 03:32:47 EST 2015: END daily cron run - status=137
__________________________________________________________________________

, . cron , :

__________________________________________________________________________
Mon Nov 23 13:01:05 EST 2015: START hourly cron run
__________________________________________________________________________
/var/lib/openshift/55a000094/app-root/runtime/repo//.openshift/cron/hourly/add_stocks:
...

cron .

+4
2

, , , .
, cron :

/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh daily

cron:

__________________________________________________________________________
Wed Nov 25 03:24:19 EST 2015: START daily cron run
__________________________________________________________________________
/var/lib/openshift/55a000094/app-root/runtime/repo//.openshift/cron/daily/update_dave_list:
WARNING:py.warnings:/var/lib/openshift/55a000094/python/virtenv/lib/python2.7/site-packages/django_crontab-0.6.0-py2.7.egg/django_crontab/crontab.py:13: RemovedInDjango19Warning: django.uti$
  from django.utils.importlib import import_module
Wed Nov 25 03:24:38 EST 2015
/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh: line 114: 375681 Killed                  $executor "$SCRIPTS_DIR"
Warning: daily cron run terminated as it exceeded max run time

, update_dave_list. update_dave_list :

#!/bin/bash
/var/lib/openshift/55a000094/python/virtenv/bin/python /var/lib/openshift/55a000094/app-root/runtime/repo/wsgi/digrin/manage.py crontab run 18e10bf4fb92741b69745d8a480230a3 # update dave lists
date

, → update_dave_list ! (Wed Nov 25 03:24:38 EST 2015) , openshift, update_dave_list , , ( ). . , 20 , . , cron ( cron), , .
! , Openshift ! !

+5

, .

, , urlopen() xls OpenShift? , - . .

+1

Source: https://habr.com/ru/post/1616504/


All Articles