Skip to content

Commit

Permalink
Adds statistics to Python hello world example.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjoneil authored Sep 25, 2024
1 parent 0f162ce commit d699df9
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions python-hello-world/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import nextmv

# Read from stdin.
input = nextmv.load_local()
name = input.data["name"]
if __name__ == "__main__":
# Read from stdin.
input = nextmv.load_local()
name = input.data["name"]

##### Insert model here
##### Insert model here

# Print logs that render in the run view in Nextmv Console
nextmv.log(f"Hello, {name}")
# Print logs that render in the run view in Nextmv Console
nextmv.log(f"Hello, {name}")

# Write output and statistics.
output = nextmv.Output(solution=None, statistics={"message": f"Hello, {name}"})
nextmv.write_local(output)
# Write output and statistics to stdout.
output = nextmv.Output(
solution=f"Hello, {name}",
statistics=nextmv.Statistics(
result=nextmv.ResultStatistics(custom={"length": len(name)}),
),
)
nextmv.write_local(output)

0 comments on commit d699df9

Please sign in to comment.