-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19506 from kbrock/cu_capture_gap
metrics capture gap by ems
- Loading branch information
Showing
5 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#!/usr/bin/env ruby | ||
require File.expand_path('../config/environment', __dir__) | ||
|
||
if ARGV.length != 2 | ||
puts "Usage: rails runner #{$0} start_date end_date" | ||
if ARGV.length < 2 || ARGV.length > 3 | ||
puts "Usage: rails runner #{$PROGRAM_NAME} start_date end_date [ems_id]" | ||
puts | ||
puts " start_date and end_date must be in iso8601 format (e.g. 2010-02-15T00:00:00Z)." | ||
exit 1 | ||
end | ||
start_date, end_date = *ARGV | ||
start_date, end_date, ems_id = *ARGV | ||
|
||
def log(msg) | ||
$log.info("MIQ(#{__FILE__}) #{msg}") | ||
puts msg | ||
end | ||
|
||
log("Queueing metrics capture for [#{start_date}..#{end_date}]...") | ||
Metric::Capture.perf_capture_gap(Time.parse(start_date), Time.parse(end_date)) | ||
Metric::Capture.perf_capture_gap(Time.parse(start_date).utc, Time.parse(end_date).utc, nil, ems_id&.to_i) | ||
log("Queueing metrics capture for [#{start_date}..#{end_date}]...Complete") |