-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
# coding=utf-8 | ||
from __future__ import division, print_function, unicode_literals | ||
from sacred import Experiment | ||
|
||
ex = Experiment('hello_config_scope') | ||
|
||
|
||
# A ConfigScope is a function like this decorated with @ex.config | ||
# All local variables of this function will be put into the configuration | ||
@ex.config | ||
def cfg(): | ||
recipient = "world" | ||
message = "Hello %s!" % recipient | ||
|
||
|
||
@ex.pre_run | ||
def foobar(command_name, config_updates, named_configs): | ||
print('FOOOOBAR:', command_name) | ||
config_updates['recipient'] = 'FOOO' | ||
return command_name, config_updates, named_configs | ||
|
||
|
||
# again we can access the message here by taking it as an argument | ||
@ex.automain | ||
def main(message): | ||
print(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters