Skip to content

Commit 5a71e33

Browse files
committed
Fixed daemon installation
*Changed version to 0.0.2
1 parent 244deda commit 5a71e33

8 files changed

+154
-25
lines changed

History.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
=== 0.0.2 2011-07-12
2+
3+
Fixed daemon installation
4+
15
=== 0.0.1 2011-06-28
26

37
* 1 major enhancement:

Manifest.txt

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1+
bin/queue_manager.rb
2+
bin/sqstat
3+
bin/sqsub
4+
bin/sqs_install_daemon
15
History.txt
6+
lib/scbi_queue_system/autolaunch/com.scbi_queue_system.plist
7+
lib/scbi_queue_system/autolaunch/sqsd-linux
8+
lib/scbi_queue_system/done_job_list.rb
9+
lib/scbi_queue_system/internal_config/internal_config.json
10+
lib/scbi_queue_system/job_list.rb
11+
lib/scbi_queue_system/queued_job_list.rb
12+
lib/scbi_queue_system/running_job_list.rb
13+
lib/scbi_queue_system.rb
214
Manifest.txt
315
PostInstall.txt
4-
README.rdoc
516
Rakefile
6-
lib/scbi_queue_system.rb
17+
README.rdoc
718
script/console
819
script/destroy
920
script/generate
21+
test/submit_script.sh
1022
test/test_helper.rb
1123
test/test_scbi_queue_system.rb

README.rdoc

+97-7
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,122 @@
11
= scbi_queue_system
22

3-
* http://github.com/#{github_username}/#{project_name}
3+
* http://www.scbi.uma.es/downloads
44

55
== DESCRIPTION:
66

7-
FIX (describe your package)
7+
scbi_queue_system (SQS) handles a simple queue of jobs executions over multiple machines (clustered installation) or your own personal computer.
88

99
== FEATURES/PROBLEMS:
1010

11-
* FIX (list of features or problems)
11+
* SQS can be used as very simple batch queue system for personal multicore computers as well as for small clusters
12+
* It handles machines with different number of cores/CPUs
13+
* It believes on well intentioned users, and because of that it doesn't kill jobs if they are using more CPUs than requested
14+
* All jobs run under the same user (the one that SQS manager run under)
1215

1316
== SYNOPSIS:
1417

15-
FIX (code sample of usage)
18+
Once SQS is installed and queue manager is running, you can start using it:
19+
20+
=== To submit a new job:
21+
22+
sqsub file.sh
23+
24+
where file.sh is a script file where you run your programs. Example file issuing ls and hostname commands:
25+
26+
$> cat file.sh
27+
#!/usr/bin/env bash
28+
29+
ls
30+
hostname
31+
32+
=== To submit a new job using 4 cpus:
33+
34+
sqsub file.sh 4
35+
36+
You can also set the cpu count inside the submit script this way:
37+
38+
$> cat file.sh
39+
#!/usr/bin/env bash
40+
# CPUS = 4
41+
42+
ls
43+
hostname
44+
45+
=== To view queue status
46+
47+
sqstat
48+
49+
To view already done jobs:
50+
51+
sqstat -d
52+
1653

1754
== REQUIREMENTS:
1855

19-
* FIX (list of requirements)
56+
* OS X / linux operating systems.
2057

2158
== INSTALL:
2259

23-
* FIX (sudo gem install, anything else)
60+
=== 1.- Personal/standalone computer:
61+
62+
In a personal installation, all pieces of the queue system are installed on the same computer. To install the queue manager on one computer:
63+
64+
gem install scbi_queue_system
65+
66+
Once installed, you should start the queue manager:
67+
68+
queue_manager.rb
69+
70+
By default, it is configured to use localhost with 1 cpu as testing
71+
72+
<b>NOTE:</b> See automatic startup
73+
74+
75+
=== 2.-Cluster:
76+
77+
On a clustered installation you need to choose a node to act as the queue manager.
78+
79+
==== -On the manager machine
80+
81+
Install SQS on the manager machine:
82+
83+
gem install scbi_queue_system
84+
85+
Start the queue manager:
86+
87+
queue_manager.rb
88+
89+
Share your QUEUED folder with frontend machines and give write-only permission to others (chmod 772)
90+
91+
==== -On the frontends machines:
92+
93+
Later on, you should install the sqsub command on your cluster's frontend machines (the one/ones from where you are going to submit jobs).
94+
95+
gem install scbi_queue_system
96+
97+
=== 3.- Environment variables:
98+
99+
* SQS_BASE_PATH : sets the location of sqs directoies.
100+
101+
* SQS_QUEUED_PATH : sets the location of QUEUED directory. This location must be shared and with write only permissions for all SQS clients (those that need to use sqsub).
102+
103+
* SQS_LOG_FILE: sets the location of log files.
104+
105+
=== 4.- Automatic startup
106+
107+
Once the gem is installed you can start the queue manager (it is recommended to setup automatic startup so you don't have to start it manually after each reboot). The queue manager only should be started up in the manager machine, and not on frontends.
108+
109+
==== -On Linux
110+
111+
112+
==== -On Mac OS X
113+
24114

25115
== LICENSE:
26116

27117
(The MIT License)
28118

29-
Copyright (c) 2011 FIXME full name
119+
Copyright (c) 2011 Dario guerrero
30120

31121
Permission is hereby granted, free of charge, to any person obtaining
32122
a copy of this software and associated documentation files (the

Rakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Hoe.plugin :newgem
1111
# Generate all the Rake tasks
1212
# Run 'rake -T' to see list of generated tasks (from gem root directory)
1313
$hoe = Hoe.spec 'scbi_queue_system' do
14-
self.developer 'FIXME full name', 'FIXME email'
14+
self.developer 'Dario Guerrero', '[email protected]'
1515
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
1616
self.rubyforge_name = self.name # TODO this is default value
17-
# self.extra_deps = [['activesupport','>= 2.0.2']]
17+
self.extra_deps = [['json','>= 1.5.3']]
1818

1919
end
2020

bin/queue_manager.rb

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
$: << File.join(File.dirname(__FILE__),'..','lib')
3+
# $: << File.join(File.dirname(__FILE__),'..','lib')
44

55
require 'scbi_queue_system'
66
require 'logger'
@@ -9,9 +9,19 @@
99
require 'queued_job_list'
1010
require 'done_job_list'
1111

12+
system_log_message="SCBI SQS queue at: #{QUEUED_PATH}"
13+
`logger "#{system_log_message}"`
1214

13-
# $LOG = Logger.new(LOG_FILE, 10, 1024000)
14-
$LOG = Logger.new(STDOUT, 10, 1024000)
15+
user=`whoami`
16+
system_log_message="SCBI SQS user: #{user}"
17+
`logger "#{system_log_message}"`
18+
19+
20+
$LOG = Logger.new(LOG_FILE, 10, 1024000)
21+
22+
# $LOG = Logger.new(STDOUT, 10, 1024000)
23+
24+
$LOG.level = Logger::INFO
1525

1626
$LOG.info 'Starting up SQS'
1727

@@ -35,7 +45,16 @@ def load_config
3545

3646
config[:polling_time] = 10
3747
config[:machine_list] = []
38-
machine={:name=>'localhost', :cpus => 1}
48+
49+
cpus=1
50+
51+
if RUBY_PLATFORM.downcase.include?("darwin")
52+
cpus=`hwprefs -cpu_count`.chomp.to_i
53+
else
54+
cpus=`grep processor /proc/cpuinfo |wc -l`.chomp.to_i
55+
end
56+
57+
machine={:name=>'localhost', :cpus => cpus}
3958

4059
config[:machine_list] << machine
4160
# config[:sqs_user] = 'dariogf'

bin/sqstat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
$: << File.join(File.dirname(__FILE__),'..','lib')
3+
# $: << File.join(File.dirname(__FILE__),'..','lib')
44

55
require 'scbi_queue_system'
66
require 'optparse'

bin/sqsub

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22

3-
$: << File.join(File.dirname(__FILE__),'..','lib')
3+
# $: << File.join(File.dirname(__FILE__),'..','lib')
44

55
require 'scbi_queue_system'
66

lib/scbi_queue_system.rb

+12-8
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,33 @@
1313
if File.exists?(INTERNAL_CONFIG_PATH)
1414
config_txt=File.read(INTERNAL_CONFIG_PATH)
1515
internal_config=JSON::parse(config_txt, :symbolize_names => true)
16+
if ENV['SQS_BASE_PATH']
17+
internal_config[:base_path] = ENV['SQS_BASE_PATH']
18+
end
1619
else
1720
# default config
1821
internal_config={}
19-
internal_config[:base_path] = '/drives'
22+
internal_config[:base_path] = ENV['SQS_BASE_PATH'] || '~/.sqs'
2023
2124
f=File.open(INTERNAL_CONFIG_PATH,'w')
2225
f.puts JSON::pretty_generate(internal_config)
23-
f.close
26+
f.close
2427
end
2528
2629
JOBS_PATH=File.join(internal_config[:base_path],'sqs','jobs')
2730
28-
CONFIG_PATH=File.join('/drives','sqs','config')
31+
CONFIG_PATH=File.join(internal_config[:base_path],'sqs','config')
2932
30-
LOGS_PATH=File.join('/drives','sqs','logs')
33+
LOGS_PATH=File.join(internal_config[:base_path],'sqs','logs')
3134
3235
CONFIG_FILE=File.join(CONFIG_PATH,'config.json')
33-
LOG_FILE=File.join(LOGS_PATH,'sqs.log')
36+
37+
LOG_FILE=ENV['SQS_LOG_PATH'] || File.join(LOGS_PATH,'sqs.log')
3438
3539
# create paths
3640
FileUtils.mkdir_p([CONFIG_PATH,LOGS_PATH])
3741
38-
QUEUED_PATH=File.join(JOBS_PATH,'queued')
42+
QUEUED_PATH=ENV['SQS_QUEUED_PATH'] || File.join(JOBS_PATH,'queued')
3943
DONE_PATH=File.join(JOBS_PATH,'done')
4044
RUNNING_PATH=File.join(JOBS_PATH,'running')
4145
SENT_PATH=File.join(JOBS_PATH,'sent')
@@ -49,5 +53,5 @@
4953
5054
5155
module ScbiQueueSystem
52-
VERSION = '0.0.1'
53-
end
56+
VERSION = '0.0.2'
57+
end

0 commit comments

Comments
 (0)