]>
Commit | Line | Data |
---|---|---|
91d1c8a9 MT |
1 | From 2ee28ea5d213ce4726dd1527b6465059c9b0fa4b Mon Sep 17 00:00:00 2001 |
2 | From: Michael Tremer <michael.tremer@ipfire.org> | |
3 | Date: Thu, 24 Jan 2013 02:35:11 +0100 | |
4 | Subject: [PATCH 02/17] Remove some test code. | |
5 | ||
6 | --- | |
7 | python/pakfire/client/test.py | 54 ------------------------------------------- | |
8 | 1 file changed, 54 deletions(-) | |
9 | delete mode 100644 python/pakfire/client/test.py | |
10 | ||
11 | diff --git a/python/pakfire/client/test.py b/python/pakfire/client/test.py | |
12 | deleted file mode 100644 | |
13 | index 8bf5fd4..0000000 | |
14 | --- a/python/pakfire/client/test.py | |
15 | +++ /dev/null | |
16 | @@ -1,54 +0,0 @@ | |
17 | -#!/usr/bin/python | |
18 | - | |
19 | -import random | |
20 | -import sys | |
21 | -import time | |
22 | - | |
23 | -def fork_builder(*args, **kwargs): | |
24 | - cb = ClientBuilder(*args, **kwargs) | |
25 | - | |
26 | - try: | |
27 | - cb() | |
28 | - except Exception, e: | |
29 | - print e | |
30 | - sys.exit(1) | |
31 | - | |
32 | -class ClientBuilder(object): | |
33 | - def __init__(self, id): | |
34 | - self.id = id | |
35 | - | |
36 | - def __call__(self, *args): | |
37 | - print "Running", self.id, args | |
38 | - | |
39 | - time.sleep(2) | |
40 | - | |
41 | - if random.choice((False, False, False, True)): | |
42 | - raise Exception, "Process died" | |
43 | - | |
44 | - | |
45 | -import multiprocessing | |
46 | - | |
47 | - | |
48 | -processes = [] | |
49 | - | |
50 | -while True: | |
51 | - # Check if there are at least 2 processes running. | |
52 | - if len(processes) < 2: | |
53 | - process = multiprocessing.Process(target=fork_builder, args=(len(processes),)) | |
54 | - | |
55 | - process.daemon = True | |
56 | - process.start() | |
57 | - | |
58 | - processes.append(process) | |
59 | - | |
60 | - print len(processes), "in process list:", processes | |
61 | - | |
62 | - for process in processes: | |
63 | - time.sleep(0.5) | |
64 | - | |
65 | - print process.name, "is alive?", process.is_alive() | |
66 | - | |
67 | - if not process.is_alive(): | |
68 | - print "Removing process", process | |
69 | - print " Exitcode:", process.exitcode | |
70 | - processes.remove(process) | |
71 | -- | |
72 | 1.8.1.2 | |
73 |