supereeg
supereeg copied to clipboard
set_context function
seaborn has a nice way to set the plot styling for a particular context (like figures for a talk, poster, paper or notebook)
I was thinking we could take a similar approach with superEEG, setting a context to run the code on a single computer, cluster, or some other setups. I idea would be to:
import superEEG
superEEG.set_context('google-cluster')
This would change an internal config object that determines the behavior of our functions (how the jobs are split up etc). thoughts?
That a great idea! I like it.
Here's how I currently have it implemented. Example code:
import superEEG
# print default context
print(superEEG.context)
# change context to preset cluster default
superEEG.set_context('cluster')
# print updated context
print(superEEG.context)
# change context to custom dict
google_cluster = {
'environment' : 'google-cluster',
'nodes' : 1000000000,
'memory' : 3000000000,
}
superEEG.set_context(google_cluster)
print(superEEG.context)
Result:
{'environment': 'single', 'nodes': 1, 'memory': 8}
{'environment': 'cluster', 'nodes': 4, 'memory': 30}
{'environment': 'google-cluster', 'nodes': 1000000, 'memory': 3000000000}
We can then use this module attribute to make decisions. What do you think of this setup? What other attributes should we add to this dict?
Job submission command, code directory, scratch directory, data directory, and probably others as we go...