SimplyPy API Reference
api
get_context()
Fetch the current context used.
Source code in simplypy/api.py
28 29 30 31 32 33 34 35 | |
log_param(key_or_dict=None, value=None, **kwargs)
Logs parameters to the current simulation context. Accepts a key/value pair, a dictionary, or keyword arguments.
Source code in simplypy/api.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
log_result(id=None, value=None, path=None, save_result=True, **kwargs)
Unified function to log a result value, a dictionary of results, or a file path. If save_result is True for a path, it will create an artefact. If save_result is True for a dic or a key/value par it will add it to the blob. Both case will save a pointer to the db.
Source code in simplypy/api.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
set_context(ctx)
Update the context.
Source code in simplypy/api.py
38 39 40 41 42 | |
track(func=None, *, save_result=False, project_name=None, project_path=None)
This is a multi purpose function used to launch the tracker fo a simulation, log a specific user function or do both. It is either a function or a decorator. If the user use it as a track() at the beggining of the simulation, it will create the tracker instance for the run. If used as a decorator it will either create the tracker if it does not exist and log the function in callstack and its IO and some metadata.
Source code in simplypy/api.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
metadata
get_imports()
This function will get all the imports used in a python script and sort them between user imports and system imports and also will differentiate if an import is a library or a script made by the user.
Source code in simplypy/metadata.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
get_main_script()
Get the location of the main script
Source code in simplypy/metadata.py
45 46 47 48 49 50 51 52 | |
load_main_script_source()
Get the source code of the main script where the user created the tracker
Source code in simplypy/metadata.py
54 55 56 57 58 59 60 61 62 63 64 65 | |
save_custom_sources(custom_modules)
Get the source code of each user imports
Source code in simplypy/metadata.py
31 32 33 34 35 36 37 38 39 40 41 42 43 | |
serverCom
ServerCom
Source code in simplypy/serverCom.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
dump_run()
This function will tell the server to dump the content of the run to the database.
Source code in simplypy/serverCom.py
54 55 56 57 58 59 60 61 | |
tracker
Tracker
The tracker is the mirror on the client side of the simulation object on the server. Its tasks during the run of the simulation is to send command to the server from run specific command to user entered command via the api. It will start a connection to the server thanks to the ServerCom object and then will expose its method to the api for the user to use. It will also log some simply specific metadata on the run and send it to the server. (Like what language is used, where is the simulation launch, a profiler)
Source code in simplypy/tracker.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
close()
Method that will be launched when the run is ended. It will save the profiler data and get the runtime. It will also close the connection to the server.
Source code in simplypy/tracker.py
77 78 79 80 81 82 83 84 85 86 87 88 89 | |
metadata_pysimply()
Send some basic metadata at every run
Source code in simplypy/tracker.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
start_profiler()
Start a python profiler for the run
Source code in simplypy/tracker.py
69 70 71 72 73 74 75 | |