-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathextras.py
29 lines (26 loc) · 925 Bytes
/
extras.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from bueno.public import experiment
from bueno.public import logger
from bueno.public import data
from bueno.public import utils
try:
import mymod
from mypackage import mypackmod
except ImportError:
pass
else:
# Because bueno cannot easily determine what extra stuff was imported at
# run-time, add the extras by hand to our run's data.
data.add_asset(data.PythonModuleAsset(mymod))
data.add_asset(data.PythonModuleAsset(mypackmod))
def main(argv):
experiment.name('hello-extras')
logger.log('This is an example of how to use extras')
# Use the extra modules we specified at run-time if they are loaded.
if utils.module_imported('mymod'):
mymod.say_hello()
else:
logger.log('*** NOTE: mymod is not imported ***')
if utils.module_imported('mypackage'):
mypackmod.say_hello()
else:
logger.log('*** NOTE: mypackmod is not imported ***')