Skip to content

Repository files navigation

Simvue Python client


Simvue

Collect metadata, metrics and artifacts from simulations, processing and AI/ML training tasks running on any platform, in real time.

Configuration

The service URL and token can be defined as environment variables:

export SIMVUE_URL=...
export SIMVUE_TOKEN=...

or a file simvue.toml can be created containing:

[server]
url = "..."token = "..."

The exact contents of both of the above options can be obtained directly by clicking the Create new run button on the web UI. Note that the environment variables have preference over the config file.

Usage example

fromsimvueimportRun
...
if__name__=="__main__":
...
# Using a context manager means that the status will be set to completed automatically,# and also means that if the code exits with an exception this will be reported to SimvuewithRun() asrun:
# Specify a run name, metadata (dict), tags (list), description, folderrun.init('example-run-name',
{'learning_rate': 0.001, 'training_steps': 2000, 'batch_size': 32}, # Metadaata
['tensorflow'], # Tags'This is a test.', # Description'/Project-A/part1') # Folder full path# Set folder details if necessaryrun.set_folder_details('/Project-A/part1', # Folder full pathmetadata={}, # Metadatatags=['tensorflow'], # Tagsdescription='This is part 1 of a test') # Description# Upload the coderun.save_file('training.py', 'code')
# Upload an input filerun.save_file('params.in', 'input')
# Add an alert (the alert definition will be created if necessary)run.create_metric_threshold_alert(
name='loss-too-high', # Namerule='is above', # Rulemetric='loss', # Metricfrequency=1, # Frequencywindow=1, # Windowthreshold=10, # Thresholdnotification='email'# Notification type
)
...
whilenotconverged:
...
# Send metrics inside main application looprun.log_metrics({'loss': 0.5, 'density': 34.4})
...
# Upload an output filerun.save_file('output.cdf', 'output')
# If we weren't using a context manager we'd need to end the run# run.close()

License

Released under the terms of the Apache 2 license.

About

Simvue Python API

Topics

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages