ServerPool
Bases: Thread
ServerPool is meant to be reached by any other Python terminal using the SumbitToServer function from PoolFlow.utilities. It is currently highly experimental !
Examples:
Setting up the pool
>>> import PoolFlow as pf
>>> import os
>>> import time
>>> pool = pf.ServerPool(override_max_value=20, output='test.log')
In any other instance:
>>> from PoolFlow.utilities import SubmitToServer as smbv
>>> smbv(('C:\Users\Myself\Documents\File.py', '1')) #Sumbit file with 1Go cost
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idle_time |
int, optional
|
The time in seconds between each verification by the system of the current resources allocations (default is 1) |
1
|
refresh_time |
int, optional
|
The time in seconds between each status emission by the pool (default is 5) |
5
|
override_max_value |
int or None, optional
|
The maximum virtual memory available in the system/for the pool. If None, will get the maximum from the OS (default is None) |
None
|
output |
str or None, optional
|
The file to write the output. If none, will write on the console. (default is None) |
'/var/log/ServerPool.log'
|
Source code in PoolFlow\server_pool.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
run()
The running function of the pool. Is called by start method - Not meant to be called by the user -
Source code in PoolFlow\server_pool.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
status()
Writes the current status in output file
Source code in PoolFlow\server_pool.py
67 68 69 70 71 72 73 |
|
stop()
Ends server
Source code in PoolFlow\server_pool.py
81 82 83 84 85 86 87 |
|