newron.log_artifacts()
newron.log_artifacts(local_dir: str, artifact_path: Optional[str] = None) → None
Log all the contents of a local directory as artifacts of the run. If no run is active, this method will create a new active run.
Parameters -
- local_dir - Denotes the path to the directory of files to write.
- artifact_path - If provided, it denotes the directory in artifact_uri to write to
Example
import os
import json
import newron
# Create some files to preserve as artifacts
features = "rooms, zipcode, median_price, school_rating, transport"
data = {"state": "TX", "Available": 25, "Type": "Detached"}
# Create couple of artifact files under the directory "data"
os.makedirs("data", exist_ok=True)
with open("data/data.json", 'w', encoding='utf-8') as f:
json.dump(data, f, indent=2)
with open("data/features.txt", 'w') as f:
f.write(features)
# Write all files in "data" to root artifact_uri/states
newron.log_artifacts("data", artifact_path="states")