File: slow_process_for_testing.py

package info (click to toggle)
python-ruffus 2.6.3%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,828 kB
  • ctags: 2,843
  • sloc: python: 15,745; makefile: 180; sh: 14
file content (22 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python
from __future__ import print_function
import sys, os, time
print ("    ", os.getcwd(), file = sys.stderr)
print ("    ", os.environ, file = sys.stderr)
loop_variable = 0
loop_limit = 4
while True:
    if loop_variable >= loop_limit:
        break
    try:
        sys.stderr.write("    Stderr %d\n" % loop_variable)
        sys.stderr.flush()
        sys.stdout.write("    Stdout %d\n" % loop_variable)
        sys.stdout.flush()
        loop_variable += 1
        time.sleep(0.5)
    except:
        sys.stderr.write("    Ignore Exception. Now you have made me angry: I won't stop till 100\n")
        loop_limit = 100
        pass