Ask Your Question
1

Logging failing after a while

asked 2016-06-09 16:09:02 +0100

stefanutti gravatar image

updated 2016-06-10 01:00:14 +0100

tmonteil gravatar image

Hi,

I have a program that if I run multiple times inside the cloud sage worksheet, after a while (3-4 runs) gets a strange KeyboardInterrupt error.

Do you know what it is

Here is the code to reproduce the problem:

import logging
import logging.config
import logging.handlers

import sys

# Set logging facilities
#
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
loggingStreamHandler = logging.StreamHandler(sys.stdout)
loggingStreamHandler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s --- %(message)s'))
logger.addHandler(loggingStreamHandler)

for i in range(100):
    logger.info ("Ciaooooooo: %s", 1000)

logger.info ("End: %s", 1000)

2016-06-09 14:06:18,765 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,766 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,768 - INFO --- Ciaooooooo: 1000
Error in lines 12-13
Traceback (most recent call last):
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 2, in <module>
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1165, in info
    self._log(INFO, msg, args, **kwargs)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1284, in _log
    self.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1294, in handle
    self.callHandlers(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1334, in callHandlers
    hdlr.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 883, in emit
    self.flush()
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 843, in flush
    self.stream.flush()
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 369, in flush
    self._f(self._buf, done=done)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1016, in stdout
    self._send_output(stdout=stdout, done=done, id=self._id, once=once)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 529, in _send_output
    raise KeyboardInterrupt
KeyboardInterrupt
    ​
edit retag flag offensive close merge delete

Comments

Please post a link to a worksheet that replicates this issue.

It might just be the output limiter, which is customizable. Type "smc?" in the worksheet to learn about how to adjust the limits.

William Stein gravatar imageWilliam Stein ( 2016-06-09 22:39:02 +0100 )edit

FWIW, i can not reproduce this on a classical Sage install: command line, Sage notebook and Jupyter notebook all reach "End: 1000".

tmonteil gravatar imagetmonteil ( 2016-06-10 00:59:50 +0100 )edit

I'm running inside the free cloud sage machines. The link to reproduce the problem is here.

I'can execute it 2 times and at the third it breaks!

https://cloud.sagemath.com/projects/c...

stefanutti gravatar imagestefanutti ( 2016-06-10 10:52:16 +0100 )edit

I solved using this:

sage_server.MAX_OUTPUT_MESSAGES = 10000000

Also a restart between runs solves the issue.

stefanutti gravatar imagestefanutti ( 2016-06-10 13:30:19 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-06-21 11:45:42 +0100

stefanutti gravatar image

I solved using this: sage_server.MAX_OUTPUT_MESSAGES = 10000000 Also a restart between runs solves the issue.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-09 16:09:02 +0100

Seen: 839 times

Last updated: Jun 21 '16