Opened 10 years ago

Closed 10 years ago

#14079 closed enhancement (fixed)

Cython interface to pselect() system call

Reported by: Jeroen Demeyer Owned by: Jason Grout
Priority: major Milestone: sage-5.9
Component: misc Keywords:
Cc: Merged in: sage-5.9.beta0
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #14080, #12415 Stopgaps:

Status badges

Description

Useful for the new doctesting framework.

Attachments (1)

14079_pselecter.patch (15.4 KB) - added by Jeroen Demeyer 10 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 10 years ago by Jeroen Demeyer

Dependencies: #14080

comment:2 Changed 10 years ago by Jeroen Demeyer

I'm intentionally not setting it to needs_review yet, because I want to first have a use case (that will be #12415). But that being said, the code here is supposed to be finished.

comment:3 Changed 10 years ago by David Roe

Testing on 5.6 I get a doctest framework error (since you use the new ....: continuation). But testing on 5.7.beta1 with #12415 I get a timeout on line 308 (r, w, x, t = PSelecter().pselect([f,g,f,f,g])).

comment:4 in reply to:  3 ; Changed 10 years ago by Jeroen Demeyer

Replying to roed:

with #12415 I get a timeout on line 308 (r, w, x, t = PSelecter().pselect([f,g,f,f,g])).

On which kind of system is that?

comment:5 in reply to:  4 Changed 10 years ago by David Roe

Replying to jdemeyer:

Replying to roed:

with #12415 I get a timeout on line 308 (r, w, x, t = PSelecter().pselect([f,g,f,f,g])).

On which kind of system is that?

OS X 10.6.8, Core 2 Duo.

comment:6 Changed 10 years ago by Jeroen Demeyer

Updated patch (I haven't looked at the OS X specific issue).

comment:7 Changed 10 years ago by David Roe

See http://stackoverflow.com/questions/14045801/different-pselect-behaviour-on-osx-vs-linux for a possible explanation of what's going on on OS X.

comment:8 Changed 10 years ago by Jeroen Demeyer

Thanks for the pointer, but that doesn't seem to be the problem: no signals are involved in the failing tests you mention.

comment:9 Changed 10 years ago by Jeroen Demeyer

Status: newneeds_review

New version, works for me on OS X 10.6 with the latest version of #12415. Note that parallel testing on OS X is broken, but normal testing (with -p 1) works.

comment:10 Changed 10 years ago by David Roe

Apply failed....

comment:11 Changed 10 years ago by David Roe

Status: needs_reviewneeds_work

Changed 10 years ago by Jeroen Demeyer

Attachment: 14079_pselecter.patch added

comment:12 Changed 10 years ago by Jeroen Demeyer

Status: needs_workneeds_review

comment:13 Changed 10 years ago by David Roe

What was the problem on OS X?

comment:14 Changed 10 years ago by Jeroen Demeyer

The problem on OS X is:

sage: import select
sage: f = open(os.devnull)
sage: select.select([],[],[f])
([], [], [<open file '/dev/null', mode 'r' at 0x113ac7420>])

For some reason, most files have an "exceptional condition" by default on OS X. I have no idea why or what this means.

comment:15 Changed 10 years ago by David Roe

So is this causing the problems for parallel testing on OS X? Do you know how to get around it?

comment:16 in reply to:  15 Changed 10 years ago by Jeroen Demeyer

Replying to roed:

So is this causing the problems for parallel testing on OS X?

No, this has nothing to do with parallel. The parallel testing should be fixed now.

The parallel testing problem with #12415 on OS X was due to Pdb() importing readline. Importing readline hangs (probably because more than one process tries to take control over the terminal somehow). The solution is simply not starting Pdb if not needed.

comment:17 Changed 10 years ago by Jeroen Demeyer

Dependencies: #14080#14080, #12415

comment:18 Changed 10 years ago by Volker Braun

Dependencies: #14080, #12415#14080
Reviewers: Volker Braun

Looks good to me. Doesn't actually depend on #12415

comment:19 Changed 10 years ago by Volker Braun

Status: needs_reviewneeds_work

I get the following:

Traceback (most recent call last):
  File "/home/vbraun/.sage//tmp/pselect_21760.py", line 458, in <module>
    runner=runner)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/sagedoctest.py", line 54, in testmod_returning_runner
    runner=runner)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 1819, in testmod_returning_runner
    for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 839, in find
    self._find(tests, obj, name, module, source_lines, globs, {})
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 893, in _find
    globs, seen)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 881, in _find
    test = self._get_test(obj, name, module, globs, source_lines)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 965, in _get_test
    filename, lineno)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 594, in get_doctest
    return DocTest(self.get_examples(string, name), globs,
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 608, in get_examples
    return [x for x in self.parse(string, name)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 570, in parse
    self._parse_example(m, name, lineno)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 628, in _parse_example
    self._check_prompt_blank(source_lines, indent, name, lineno)
  File "/home/vbraun/opt/sage-5.8.beta1/local/bin/ncadoctest.py", line 715, in _check_prompt_blank
    line[indent:indent+3], line))
ValueError: line 14 of the docstring for __main__.example_6 lacks blank after ...: '            ....:     global got_child'
Exception raised by doctesting framework. Use -verbose for details.

comment:20 in reply to:  19 Changed 10 years ago by Jeroen Demeyer

Dependencies: #14080#14080, #12415
Status: needs_workneeds_review

Replying to vbraun:

I get the following:

Exception raised by doctesting framework. Use -verbose for details.

That's exactly why there was a dependency on #12415, I'm using new doctest syntax.

comment:21 Changed 10 years ago by David Roe

Status: needs_reviewpositive_review

I just talked to Volker. Looks good to us.

comment:22 Changed 10 years ago by Jeroen Demeyer

Milestone: sage-5.8sage-5.9

comment:23 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.9.beta0
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.