1

進行状況を追跡するために、コード全体にいくつかの出力を含む長いpythonスクリプトをWindowsコマンドラインで実行しています。

特定の印刷の直前に、Python コードの実行が停止し、CPU 使用率がゼロになります。コマンドラインウィンドウをアクティブウィンドウとしてキーボードのランダムキーを押すことで、Pythonを「目覚めさせる」ことができます。

タスク マネージャーを使用すると、CPU 使用率が急上昇し、印刷行が処理され (「処理に 219 秒かかりました」)、スクリプトが再び実行されることがわかります。

なぜこのファイルを赤ちゃんのように監視しなければならないのですか? また、これを行わないようにコードを作成するにはどうすればよいですか?

-CC

start = time.time()
monthsOfInterestSorted = sorted(monthsOfInterest)
if debug:
    print "calculateTradingActivity:\n\tcalculating"
tradingActivityComplete = (tsc.calculateTradingActivity(daily_volume, daily_shares, daily_dates, monthsOfInterestSorted))
if debug:
    print "\tlisting"
tradingActivityList = []
## this matrix should have unique sedol rows and date columns (date x sedol)
for sedol, date in zip(monthly_sedol_list, monthly_dates_list):
    try:
        tradingActivityList.append(tradingActivityComplete[daily_sedol.index(sedol)][monthsOfInterestSorted.index(date)])
    except ValueError:
        print "\t\tMissing trading activity data for:", sedol, date
        tradingActivityList.append('NA')
print '\tProcess took %d seconds' % (time.time()-start)
4

0 に答える 0