-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stores metadata about executors and what they're working on
- Loading branch information
Showing
11 changed files
with
142 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Mosquito::Inspector | ||
class Executor | ||
getter instance_id : String | ||
|
||
def initialize(@instance_id) | ||
@metadata = Metadata.new Mosquito::Runners::Executor.metadata_key(@instance_id), readonly: true | ||
end | ||
|
||
def config | ||
key = Mosquito.backend.build_key "runners", name | ||
config = Mosquito.backend.retrieve key | ||
end | ||
|
||
def current_job : String? | ||
@metadata["current_job"]? | ||
end | ||
|
||
def current_job_queue : String? | ||
@metadata["current_job_queue"]? | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Mosquito::Inspector | ||
class Overseer | ||
Log = ::Log.for self | ||
|
||
getter metadata : Metadata | ||
getter instance_id : String | ||
|
||
def self.all : Array(self) | ||
Mosquito.backend.list_overseers.map do |name| | ||
new name | ||
end | ||
end | ||
|
||
def initialize(@instance_id : String) | ||
@metadata = Metadata.new Mosquito::Runners::Overseer.metadata_key(@instance_id), readonly: true | ||
end | ||
|
||
def executors : Array(Executor) | ||
if executor_list = @metadata["executors"]? | ||
executor_list.split(",").map do |name| | ||
Executor.new name | ||
end | ||
else | ||
[] of Executor | ||
end | ||
end | ||
|
||
def <=>(other) | ||
name <=> other.name | ||
end | ||
|
||
def last_heartbeat : Time? | ||
metadata.heartbeat? | ||
end | ||
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.