gym-cache
OpenAI based Gym environments for training RL caching agent
install it:
pip install gym-cache
import it like this:
import gym
gym.make('gym_cache:Cache-v0')
observation space has following variables:
- six tokens (integers)
- file size [kB]
- how full is the cache at that moment
There are two discrete action environments (Cache-v0 and Cache-large-v0) and one continuous action environment (Cache-continuous-v0).
Data extractions and preprocessing
This is a two step procedure:
- extract raw data data/extract_data.py - change PQ, date range
- process raw data data/process_data.py - tokenizes filenames, generates unique fileIDs, sorts by access time.
Processed data should be copied to the directory where actor runs. It is a parque file (.pa) with one dataframe:
- index - access time (sorted)
- six tokens derived from the filename ('1', '2', '3', '4', '5', '6')
- filesize ('kB')
- unique file identifier ('fID')
Rewards
- always negative and correspond to cost to get the file - if it was cached it will be smaller
- files are cached irrespectively from what action actor performed for the file
- cleanup: environment memorizes actions. on cleanup it first deletes files judged not to be needed again (action 0 in discrete environments or smaller values in continues environment). If multiple files have the same action value, LRU one is removed first.
Possible technical implementation in XCache server
- There are additional containers in the pod.
- environment container
- recieves gstream pfc, and disk info
- recalculates new state, reward, tokenizes recieved gstream info.
- memorizes last state, actors actions for each file
- triggers cleanup at lower HWM then xcache itself. Loops through memorized paths and removes ones least probably needed.
- redis db - used by environment container to store actor responses
- actor container
- environment container
Miscalenious
To change environments:
Metadata
Release files for gym-cache 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gym_cache-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / gym_cache-1.0.3-py3-none-any.whl
| Download URL | gym_cache-1.0.3-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e266c41a2495f1b513be7b830ab06664fa086c283a394196ce46dbaf183dcce
|
|
BLAKE2b-256 checksum How to use checksums |
8ec0527bf73d500f1301f82e2644ac3df829f8608423d099232e5bfa57571b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.5
|