tools/cpee in cpee-1.5.6 vs tools/cpee in cpee-1.5.7
- old
+ new
@@ -31,16 +31,18 @@
opt.summary_indent = ' ' * 2
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] ui | cpui DIR | new DIR | archive DIR URL | abandon URL\n"
opt.on("Options:")
opt.on("--help", "-h", "This text") { puts opt; exit }
opt.on("")
- opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR. Examples:\ncpee archive ./archive http://localhost:9298/\ncpee archive ./archive http://localhost:9298/1/"))
+ opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR. Examples:\ncpee archive ./archive http://localhost:9298/\ncpee archive ./archive http://localhost:9298/1/\ncpee archive ./archive http://localhost:9298/1-200"))
opt.on("")
- opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned.\ne.g. cpee abandon http://localhost:9298/1/"))
+ opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200"))
opt.on("")
- opt.on(wrap("[delete! URL] DANGER ZONE. Vanishes forever. Not in archive.\ne.g. cpee delete! http://localhost:9298/1/"))
+ opt.on(wrap("[start URL] stopped processes are started; all others are not touched. Examples:\ncpee start http://localhost:9298/1-200"))
opt.on("")
+ opt.on(wrap("[delete! URL] DANGER ZONE. Vanishes forever. Not in archive. Examples:\ncpee delete! http://localhost:9298/1/"))
+ opt.on("")
opt.on(wrap("[new DIR] scaffolds a sample execution engine. Everything except instances can be removed for default behaviour."))
opt.on("")
opt.on(wrap("[inst DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
opt.on("")
opt.on(wrap("[cpui DIR] scaffolds a sample html client. New versions might require manual merging if you changed something."))
@@ -160,9 +162,26 @@
Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
when "running" then
Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopped")
sleep 1
Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
+ end
+ end
+ end
+elsif command == 'start'
+ base = File.dirname(p1)
+ names = []
+ if File.basename(p1) =~ /(\d+)-(\d+)/
+ names = ($1.to_i..$2.to_i).to_a
+ else
+ names << File.basename(p1)
+ end
+ names.each do |name|
+ res = Typhoeus.get(File.join(base,name.to_s,'properties','values','state','/'))
+ if res.success?
+ case res.response_body
+ when "stopped" then
+ Typhoeus.put(File.join(base,name.to_s,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=running")
end
end
end
elsif command == 'delete!'
Typhoeus.delete(File.join(p1,'/'))