Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
17e9ea0
Clean slate for Workers V2.
cpkleynhans Feb 5, 2014
ae7cd75
Initial skeleton.
cpkleynhans Feb 5, 2014
20fecb1
Forgot to update the files array.
cpkleynhans Feb 5, 2014
0e6c12d
First try at getting Travis set up.
cpkleynhans Feb 5, 2014
dfb2af4
Need to install the development group to run tests.
cpkleynhans Feb 5, 2014
23b8f17
Specify our own install script for travis.
cpkleynhans Feb 5, 2014
c6186f4
Made :spec the default Rake task.
cpkleynhans Feb 5, 2014
b7b8a01
Added Queue class and TestQueue implementation.
cpkleynhans Feb 5, 2014
dc32868
Added *.swp to gitignore.
cpkleynhans Feb 5, 2014
bfca834
Added some placeholder methods to Worker.
cpkleynhans Feb 5, 2014
acd035f
More skeleton.
cpkleynhans Feb 5, 2014
f00aa28
More skeleton work.
cpkleynhans Feb 5, 2014
7835e29
Filled out how we want the executable to work.
cpkleynhans Feb 6, 2014
bd05bc4
Add .rvmrc to the gitignore.
cpkleynhans Feb 6, 2014
9c89cde
Fill out how the heartbeater will work.
cpkleynhans Feb 6, 2014
5e4adec
Need to pass old heartbeater to the constructor.
cpkleynhans Feb 6, 2014
3d6f641
Filled out the manager.
cpkleynhans Feb 6, 2014
a8a924a
Started filling out the worker.
cpkleynhans Feb 6, 2014
b3f047d
Use the MIT license.
cpkleynhans Feb 6, 2014
2658323
Include the LICENSE file in the gem.
cpkleynhans Feb 6, 2014
aedaa39
Fill out terminate method.
cpkleynhans Feb 6, 2014
499d086
Implemented the SqsQueue type.
cpkleynhans Feb 6, 2014
649fae3
Worker and some fixes.
cpkleynhans Feb 6, 2014
9d204f0
Fix some issues.
cpkleynhans Feb 6, 2014
041873e
Make components more modular.
cpkleynhans Feb 6, 2014
144a274
Everything except for jobs seems to work.
cpkleynhans Feb 6, 2014
9a723d1
Fix some things.
cpkleynhans Feb 6, 2014
a6f1180
Building works.
cpkleynhans Feb 6, 2014
ca91dbf
Build and Run both work with test interfaces.
cpkleynhans Feb 7, 2014
05da900
Filled out the S3 uploader and downloader.
cpkleynhans Feb 7, 2014
05a3ec7
Make the worker work with the dashboard properly.
cpkleynhans Feb 9, 2014
778680b
Add the Queue files to the gemspec.
cpkleynhans Feb 12, 2014
e4377dd
Fix creation of tmp dir.
cpkleynhans Feb 12, 2014
56cb27c
Fix the broken job specs.
cpkleynhans Feb 12, 2014
c31e843
Make the gem requirements less strict.
cpkleynhans Feb 12, 2014
eb66b26
Populate solutions for models without solutions.
cpkleynhans Feb 13, 2014
872523d
log not logger.
cpkleynhans Feb 14, 2014
bc00e28
Add the MooAlgorithm flag to the command line arguments.
cpkleynhans Mar 10, 2014
a9ba32c
Fixed the HTTP auth parameters.
cpkleynhans Mar 10, 2014
0f5e3c5
Need to set the running flag outside of the thread.
cpkleynhans Mar 10, 2014
2965af9
Hard code the memory options for now.
cpkleynhans Mar 10, 2014
3e1e4b0
Fix heartbeating and job termination output.
cpkleynhans Mar 10, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ tmp
.yardoc
_yardoc
doc/

*.swp
.rvmrc
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: ruby
rvm:
- 2.1.0
- 2.0.0
install: bundle install
script: rake spec
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
source "https://rubygems.org"

gem "aws-sdk"
gem "git"
gem "httparty"
gem "safe_yaml"
gemspec
49 changes: 35 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
PATH
remote: .
specs:
amalgam-worker (0.1.0)
aws-sdk (~> 1.33)
httparty (~> 0.12)
rest_client
safe_yaml (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
aws-sdk (1.8.5)
aws-sdk (1.34.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
git (1.2.5)
httparty (0.10.2)
multi_json (~> 1.0)
diff-lcs (1.2.5)
httparty (0.12.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
json (1.7.7)
multi_json (1.7.2)
multi_xml (0.5.3)
nokogiri (1.5.9)
safe_yaml (0.9.3)
uuidtools (2.1.3)
json (1.8.1)
mini_portile (0.5.2)
multi_xml (0.5.5)
netrc (0.7.7)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
rake (10.1.1)
rest_client (1.7.2)
netrc (~> 0.7.7)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.5)
safe_yaml (1.0.1)
uuidtools (2.1.4)

PLATFORMS
ruby

DEPENDENCIES
aws-sdk
git
httparty
safe_yaml
amalgam-worker!
rake (~> 10.1)
rspec (~> 2.14)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Christopher Kleynhans

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'rspec'
require 'rspec/core'
require 'rspec/core/rake_task'

task :default => :spec

RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
end
41 changes: 41 additions & 0 deletions amalgam-worker.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Gem::Specification.new do |s|
s.name = 'amalgam-worker'
s.version = '0.1.0'
s.date = '2014-02-04'
s.summary = 'Worker program for Team Amalgam'
s.description = 'Runs moolloy build jobs and test jobs'
s.authors = [ 'Chris Kleynhans' ]
s.email = 'chris@kleynhans.ca'
s.homepage = 'http://github.com/TeamAmalgam/worker'
s.license = 'MIT'
s.files = ['LICENSE',
'lib/amalgam.rb',
'lib/amalgam/worker.rb',
'lib/amalgam/worker/manager.rb',
'lib/amalgam/worker/runner.rb',
'lib/amalgam/worker/configuration.rb',
'lib/amalgam/worker/downloader.rb',
'lib/amalgam/worker/downloader/s3_downloader.rb',
'lib/amalgam/worker/downloader/test_downloader.rb',
'lib/amalgam/worker/heartbeater.rb',
'lib/amalgam/worker/heartbeater/http_heartbeater.rb',
'lib/amalgam/worker/heartbeater/test_heartbeater.rb',
'lib/amalgam/worker/uploader.rb',
'lib/amalgam/worker/uploader/s3_uploader.rb',
'lib/amalgam/worker/uploader/test_uploader.rb',
'lib/amalgam/worker/queue.rb',
'lib/amalgam/worker/queue/sqs_queue.rb',
'lib/amalgam/worker/queue/test_queue.rb',
'lib/amalgam/worker/job.rb',
'lib/amalgam/worker/job/build_job.rb',
'lib/amalgam/worker/job/run_job.rb']
s.executables = ['amalgam-worker']

s.add_runtime_dependency 'aws-sdk', '~> 1.33'
s.add_runtime_dependency 'safe_yaml', '~> 1.0'
s.add_runtime_dependency 'httparty', '~> 0.12'
s.add_runtime_dependency 'rest_client'

s.add_development_dependency 'rake', '~> 10.1'
s.add_development_dependency 'rspec', '~> 2.14'
end
26 changes: 26 additions & 0 deletions bin/amalgam-worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env ruby

require 'amalgam/worker'
require 'safe_yaml'

SafeYAML::OPTIONS[:deserialize_symbols] = true

config_file_path = ARGV[0]
raise "Configuration path must be specified." if config_file_path.nil?

worker = Amalgam::Worker.new(config_file_path)
worker.run

Signal.trap("USR1") do
worker.termination_request
end

Signal.trap("USR2") do
worker.terminate_current_job
end

Signal.trap("HUP") do
worker.update_configuration
end

worker.join
11 changes: 0 additions & 11 deletions common.rb

This file was deleted.

117 changes: 0 additions & 117 deletions configuration.rb

This file was deleted.

4 changes: 4 additions & 0 deletions lib/amalgam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Amalgam
end

require_relative 'amalgam/worker'
49 changes: 49 additions & 0 deletions lib/amalgam/worker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require 'logger'
require_relative '../amalgam'

class Amalgam::Worker
class << self
def logger=(value)
@logger = value
end

def logger
@logger ||= Logger.new(STDERR)
return @logger
end
end

def initialize(configuration_path)
@configuration = Amalgam::Worker::Configuration.new(configuration_path)
@manager = Amalgam::Worker::Manager.new(@configuration)
end

def run
@manager.run
end

def join
@manager.join
end

def termination_request
@manager.request_termination
end

def terminate_current_job
@manager.terminate_job
end

def update_configuration
@manager.update_configuration
end
end

require_relative 'worker/manager'
require_relative 'worker/runner'
require_relative 'worker/job'
require_relative 'worker/queue'
require_relative 'worker/configuration'
require_relative 'worker/heartbeater'
require_relative 'worker/downloader'
require_relative 'worker/uploader'
Loading