Opened 7 years ago

Closed 7 years ago

#14079 closed enhancement (fixed)

Cython interface to pselect() system call

Reported by: jdemeyer Owned by: jason
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:

Description

Useful for the new doctesting framework.

Attachments (1)

14079_pselecter.patch (15.4 KB) - added by jdemeyer 7 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 7 years ago by jdemeyer

  • Dependencies set to #14080

comment:2 Changed 7 years ago by jdemeyer

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 follow-up: Changed 7 years ago by roed

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 ; follow-up: Changed 7 years ago by 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?

comment:5 in reply to: ↑ 4 Changed 7 years ago by roed

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 7 years ago by jdemeyer

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

comment:7 Changed 7 years ago by roed

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 7 years ago by jdemeyer

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 7 years ago by jdemeyer

  • Status changed from new to needs_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 7 years ago by roed

Apply failed....

comment:11 Changed 7 years ago by roed

  • Status changed from needs_review to needs_work

Changed 7 years ago by jdemeyer

comment:12 Changed 7 years ago by jdemeyer

  • Status changed from needs_work to needs_review

comment:13 Changed 7 years ago by roed

What was the problem on OS X?

comment:14 Changed 7 years ago by jdemeyer

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 follow-up: Changed 7 years ago by roed

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 7 years ago by jdemeyer

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 7 years ago by jdemeyer

  • Dependencies changed from #14080 to #14080, #12415

comment:18 Changed 7 years ago by vbraun

  • Dependencies changed from #14080, #12415 to #14080
  • Reviewers set to Volker Braun

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

comment:19 follow-up: Changed 7 years ago by vbraun

  • Status changed from needs_review to needs_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 7 years ago by jdemeyer

  • Dependencies changed from #14080 to #14080, #12415
  • Status changed from needs_work to needs_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 7 years ago by roed

  • Status changed from needs_review to positive_review

I just talked to Volker. Looks good to us.

comment:22 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.8 to sage-5.9

comment:23 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.9.beta0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.