Skip to content

Commit

Permalink
updating some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ncilfone committed May 24, 2021
1 parent f9bf3bc commit a4affc5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 16 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,25 @@ Example `spock` usage is located [here](https://github.com/fidelity/spock/blob/m

## Key Features

* Simple Declaration: Type checked parameters are defined within a `@spock` decorated class. Supports required/optional
and automatic defaults.
* [Simple Declaration](basic_tutorial/Define.md): Type checked parameters are defined within a `@spock` decorated
class. Supports required/optional and automatic defaults.
* Easily Managed Parameter Groups: Each class automatically generates its own object within a single namespace.
* Parameter Inheritance: Classes support inheritance allowing for complex configurations derived from a common base
set of parameters.
* Complex Types: Nested Lists/Tuples, List/Tuples of Enum of `@spock` classes, List of repeated `@spock` classes
* [Parameter Inheritance](advanced_features/Inheritance.md): Classes support inheritance allowing for complex
configurations derived from a common base set of parameters.
* [Complex Types](advanced_features/Advanced-Types.md): Nested Lists/Tuples, List/Tuples of Enum of `@spock` classes,
List of repeated `@spock` classes
* Multiple Configuration File Types: Configurations are specified from YAML, TOML, or JSON files.
* Hierarchical Configuration: Compose from multiple configuration files via simple include statements.
* Command-Line Overrides: Quickly experiment by overriding a value with automatically generated command line arguments.
* Immutable: All classes are *frozen* preventing any misuse or accidental overwrites.
* Tractability and Reproducibility: Save runtime parameter configuration to YAML, TOML, or JSON with a single chained
command (with extra runtime info such as Git info, Python version, machine FQDN, etc). The saved markdown file can be
used as the configuration input to reproduce prior runtime configurations.
* S3 Addon: Automatically detects `s3://` URI(s) and handles loading and saving `spock` configuration files when an
active `boto3.Session` is passed in (plus any additional `S3Transfer` configurations)
* [Hierarchical Configuration](advanced_features/Composition.md): Compose from multiple configuration files via
simple include statements.
* [Command-Line Overrides](advanced_features/Command-Line-Overrides.md): Quickly experiment by overriding a value with
automatically generated command line arguments.
* Immutable: All classes are *frozen* preventing any misuse or accidental overwrites (to the extent they can be in
Python).
* [Tractability and Reproducibility](basic_tutorial/Saving.md): Save runtime parameter configuration to YAML, TOML,
or JSON with a single chained command (with extra runtime info such as Git info, Python version, machine FQDN,
etc). The saved markdown file can be used as the configuration input to reproduce prior runtime configurations.
* [S3 Addon](addons/S3.md): Automatically detects `s3://` URI(s) and handles loading and saving `spock` configuration
files when an active `boto3.Session` is passed in (plus any additional `S3Transfer` configurations)

#### Main Contributors

Expand Down
43 changes: 40 additions & 3 deletions docs/basic_tutorial/Saving.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
# Saving

The current configuration of running python code can be saved to file by chaining the `save()` method before
the `generate()` call to the `ConfigArgBuilder` class. `spock` supports two ways to specify the path to write and the
output file can be either YAML, TOML, or JSON (via the `file_extension` keyword argument). The saved markdown file can
be used as the configuration input to reproduce prior runtime configurations.
the `generate()` call to the `ConfigArgBuilder` class. `spock` supports two different ways to specify the write path
and supports multiple output formats (YAML, TOML, or JSON -- via the `file_extension` keyword argument). Most
importantly, the saved markdown file can be used as the configuration input to reproduce prior runtime configurations.

### What Does spock Save?

By default `spock` will append extra information (via the `extra_info` kwarg) as well as the entire state of the
configuration object. Extra info includes:

- Git Info: Branch, Commit ID (SHA-1), Commit Date, Status (e.g. dirty), Origin
- Python Info: Executable Path, Version, Script Entrypoint
- Run Information: Date, Time
- Env Information: Machine FQDN, Run w/ Docker, Run w/ Kubernetes
- Spock Version

For instance, here is an example of the `tutorial.py` saved `.toml` output:

```toml
# Spock Version: v2.1.5+0.gf9bf3bc.dirty
# Machine FQDN: XXXXX.yyy.com
# Python Executable: /Users/XXXXX/.virtualenvs/spock/bin/python
# Python Version: 3.8.5
# Python Script: /XXXX/open_source/spock/examples/tutorial/basic/tutorial.py
# Run Date: 2021-05-24
# Run Time: 13:33:41
# Run w/ Docker: False
# Run w/ Kubernetes: False
# Git Branch: master
# Git Commit: f9bf3bca0098a98b994eaa2aeb257f0023704e32
# Git Date: 2021-05-10 10:33:56-04:00
# Git Status: DIRTY
# Git Origin: https://github.com/fidelity/spock.git

[ModelConfig]
save_path = "/tmp"
n_features = 64
dropout = [ 0.2, 0.1,]
hidden_sizes = [ 32, 32, 16,]
activation = "relu"
```

### Specify spock Special Parameter Type

Expand Down

0 comments on commit a4affc5

Please sign in to comment.