Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update time-logging and debugging messages #625

Closed
shorvath-noaa opened this issue Aug 2, 2023 · 2 comments
Closed

Update time-logging and debugging messages #625

shorvath-noaa opened this issue Aug 2, 2023 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@shorvath-noaa
Copy link
Contributor

We need to update our time-logging and debugging messages for the BMI implementation of V4.
For example, this is under main_v04() in main.py to initialize time-logging:

showtiming = log_parameters.get("showtiming", None)
if showtiming:
    task_times = {}
    task_times['forcing_time'] = 0
    task_times['route_time'] = 0
    task_times['output_time'] = 0
    main_start_time = time.time()

Each of these task times are updated throughout main.py as tasks are run. The final step of main_v04() is to print out total times:

if showtiming:
  task_times['total_time'] = time.time() - main_start_time

LOG.debug("process complete in %s seconds." % (time.time() - main_start_time))

if showtiming:
  print('************ TIMING SUMMARY ************')
  print('----------------------------------------')
  print(
      'Network graph construction: {} secs, {} %'\
      .format(
          round(task_times['network_creation_time'],2),
          round(task_times['network_creation_time']/task_times['total_time'] * 100,2)
      )
  )
  print(
      'Forcing array construction: {} secs, {} %'\
      .format(
          round(task_times['forcing_time'],2),
          round(task_times['forcing_time']/task_times['total_time'] * 100,2)
      )
  ) 
  print(
      'Routing computations: {} secs, {} %'\
      .format(
          round(task_times['route_time'],2),
          round(task_times['route_time']/task_times['total_time'] * 100,2)
      )
  ) 
  print(
      'Output writing: {} secs, {} %'\
      .format(
          round(task_times['output_time'],2),
          round(task_times['output_time']/task_times['total_time'] * 100,2)
      )
  )
  print('----------------------------------------')
  print(
      'Total execution time: {} secs'\
      .format(
          round(task_times['network_creation_time'],2) +
          round(task_times['forcing_time'],2) +
          round(task_times['route_time'],2) +
          round(task_times['output_time'],2)
      )
  )

Current behavior

Time logging is done in main.py, so when we run t-route through BMI functions we are not keeping track of timing.

Expected behavior

Time logging and optional print out of times when running t-route through BMI functions. I'm thinking this can go in troute_model.py, but it doesn't have to.

Steps to replicate behavior (include URLs)

Screenshots

@shorvath-noaa
Copy link
Contributor Author

@AminTorabi-NOAA

@AminTorabi-NOAA AminTorabi-NOAA mentioned this issue Aug 14, 2023
21 tasks
@AminTorabi-NOAA
Copy link
Contributor

in PR #635 and #789 the issue addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants