Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mostly complete support of reading the jobset API.
- Loading branch information
Showing
5 changed files
with
95 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
require 'gosen/model' | ||
require 'gosen/models/cluster' | ||
require 'gosen/models/grid' | ||
require 'gosen/models/job' | ||
require 'gosen/models/jobset' | ||
require 'gosen/models/node' | ||
require 'gosen/models/reservation' | ||
require 'gosen/models/site' | ||
require 'gosen/models/user' | ||
require 'gosen/session' |
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,37 @@ | ||
require 'gosen/model' | ||
require 'json' | ||
|
||
module Gosen | ||
class Job | ||
include Model | ||
attr_accessor :resources_uri, :created_at, :uri, :command, :ssh_public_key_uri, :ssh_private_key_uri, :cluster_jobs, :id, :ssh_key_path, :state, :cluster_jobs | ||
|
||
def initialize(hash) | ||
@hash = hash | ||
populate_from_hash!(@hash) | ||
@cluster_jobs = [] | ||
@hash['cluster_jobs'].each do |cj| | ||
@cluster_jobs.push(Gosen::Job::Cluster.new(cj)) | ||
end | ||
end | ||
|
||
class Cluster | ||
include Model | ||
attr_accessor :dependencies, :name, :assigned_resources, :scheduledStart, :uri, :command, :walltime, :reservation, :project, :submissionTime, :wanted_resources, :jobType, :events, :id, :cluster, :types, :resubmit_job_id, :startTime, :launchingDirectory, :queue, :assigned_network_address, :cpuset_name, :message, :state, :owner, :properties | ||
|
||
def initialize(hash) | ||
fullhash = JSON.parse(Gosen::Session.jobset[hash['uri']].get(:accept => 'application/json')) | ||
populate_from_hash!(fullhash) | ||
@events = [] | ||
fullhash['events'].each do |e| | ||
@events.push(Gosen::Job::Cluster::Event.new(e)) | ||
end | ||
end | ||
|
||
class Event | ||
include Model | ||
attr_accessor :event_id, :date, :type, :to_check, :description, :job_id | ||
end | ||
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,22 @@ | ||
require 'gosen/model' | ||
require 'json' | ||
|
||
module Gosen | ||
class Jobset | ||
include Model | ||
attr_accessor :user, :name, :uri, :updated_at, :misc, :project, :public_uri, :jobs_uri, :id, :created_at | ||
|
||
def initialize(hash) | ||
populate_from_hash!(hash) | ||
end | ||
|
||
def jobs | ||
@jobs = [] | ||
h = JSON.parse(Gosen::Session.jobset[@jobs_uri].get(:accept => 'application/json')) | ||
h.each do |job| | ||
@jobs.push(Gosen::Job.new(job)) | ||
end | ||
return @jobs | ||
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,25 @@ | ||
require 'gosen/model' | ||
require 'json' | ||
|
||
module Gosen | ||
class User | ||
attr_reader :login | ||
|
||
def initialize(login) | ||
@login = login | ||
end | ||
|
||
def uri | ||
"users/#{@login}" | ||
end | ||
|
||
def jobsets | ||
@jobsets = [] | ||
h = JSON.parse(Gosen::Session.jobset[self.uri]['jobsets'].get(:accept => 'application/json')) | ||
h.each do |jobset| | ||
@jobsets.push(Gosen::Jobset.new(jobset)) | ||
end | ||
return @jobsets | ||
end | ||
end | ||
end |