-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monitor to display detections with smooth animations
- Loading branch information
Showing
8 changed files
with
151 additions
and
55 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require "./application" | ||
|
||
class EdgeAI::Status < EdgeAI::Base | ||
base "/api/edge/ai" | ||
|
||
# status of all configured pipelines | ||
@[AC::Route::GET("/status")] | ||
def index : Hash(String, PipelineStatus) | ||
keys = Configuration::PIPELINE_MUTEX.synchronize { Configuration::PIPELINES.keys } | ||
status = {} of String => PipelineStatus | ||
keys.each { |id| status[id] = get_status(id) } | ||
status | ||
end | ||
|
||
# status of the specified pipeline | ||
@[AC::Route::GET("/status/:id")] | ||
def show( | ||
@[AC::Param::Info(description: "the id of the video stream", example: "ba714f86-cac6-42c7-8956-bcf5105e1b81")] | ||
id : String | ||
) : PipelineStatus | ||
existing = Configuration::PIPELINE_MUTEX.synchronize do | ||
# ensure the stream still exists | ||
Configuration::PIPELINES[id]? | ||
end | ||
raise AC::Error::NotFound.new("stream #{id} was removed") unless existing | ||
|
||
get_status id | ||
end | ||
|
||
def get_status(id : String) : PipelineStatus | ||
PipelineStatus.from_yaml File.read(File.join(PIPELINE_STATUS, "#{id}.yml")) | ||
rescue error | ||
Log.warn(exception: error) { "issue reading status file" } | ||
PipelineStatus.new(status_available: false) | ||
end | ||
|
||
# this file is built as part of the docker build | ||
OPENAPI = YAML.parse(File.exists?("openapi.yml") ? File.read("openapi.yml") : "{}") | ||
|
||
# returns the OpenAPI representation of this service | ||
@[AC::Route::GET("/openapi")] | ||
def openapi : YAML::Any | ||
OPENAPI | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require "json" | ||
require "yaml" | ||
|
||
class PipelineStatus | ||
include JSON::Serializable | ||
include YAML::Serializable | ||
|
||
# hash of subsystem => issue description | ||
property errors : Hash(String, String) = {} of String => String | ||
property warnings : Hash(String, String) = {} of String => String | ||
|
||
property? status_available : Bool = true | ||
property last_updated : Time | ||
|
||
def initialize(@status_available = true, @errors = {} of String => String, @warnings = {} of String => String) | ||
@last_updated = Time.utc | ||
end | ||
end |
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