[Swift-commit] r3304 - SwiftApps/adem-osg
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Mon May 3 14:56:14 CDT 2010
Author: aespinosa
Date: 2010-05-03 14:56:14 -0500 (Mon, 03 May 2010)
New Revision: 3304
Modified:
SwiftApps/adem-osg/adem-test.rb
SwiftApps/adem-osg/adem.rb
Log:
Pacman finding utilities
Modified: SwiftApps/adem-osg/adem-test.rb
===================================================================
--- SwiftApps/adem-osg/adem-test.rb 2010-05-03 19:56:12 UTC (rev 3303)
+++ SwiftApps/adem-osg/adem-test.rb 2010-05-03 19:56:14 UTC (rev 3304)
@@ -59,6 +59,15 @@
eos
assert_equal(response, app_avail(pacman_cache))
end
+
+ def test_pacman_find_firefly
+ # Firefly
+ site = {
+ :compute_element => "ff-grid.unl.edu:2119/jobmanager-pbs",
+ :app_directory => "/panfs/panasas/CMS/app"
+ }
+ assert_equal("/opt/pacman/pacman-3.28", pacman_find(site, @conf))
+ end
end
class OfflineTest < Test::Unit::TestCase
@@ -79,6 +88,10 @@
assert_equal(site_list, sites(nil, conf, "sites"))
end
+ def test_site_fork
+ assert_equal "ff-grid.unl.edu:2119/jobmanager-fork", site_fork("ff-grid.unl.edu:2119/jobmanager-pbs")
+ end
+
def test_parse_classads
site_list = YAML.load @site_list
assert_equal site_list, parse_classads(@ress.split("\n\n"))
Modified: SwiftApps/adem-osg/adem.rb
===================================================================
--- SwiftApps/adem-osg/adem.rb 2010-05-03 19:56:12 UTC (rev 3303)
+++ SwiftApps/adem-osg/adem.rb 2010-05-03 19:56:14 UTC (rev 3304)
@@ -6,6 +6,7 @@
#
require 'yaml'
+require 'ftools'
CONFIGURATION_FILE = "#{ENV['HOME']}/.adem/config"
SITES_FILE = "#{ENV['HOME']}/.adem/sites"
@@ -110,6 +111,35 @@
def app_avail(pacman_cache)
`pacman -trust-all-caches -lc #{pacman_cache}`
end
+
+def app_deploy(app, site, conf)
+ sites.each do |site|
+ root = site[:pacman] || pacman_find(site, conf)
+ site[:pacman] = root
+ pacman_install site, root, conf
+ end
+end
+
+def site_fork(compute_element)
+ compute_element.gsub /jobmanager-.*$/, "jobmanager-fork"
+end
+
+def pacman_find(site, conf)
+ contact = site_fork site[:compute_element]
+ rootdir = site[:app_directory] + "/" + conf[:virtual_organization]
+ script = <<-eos
+#!/bin/bash
+which pacman
+ eos
+ File.open("/tmp/find_pacman.sh", "w") do |dump|
+ dump << script
+ end
+ `globus-job-run #{contact} /bin/mkdir -p #{rootdir}`
+ `globus-job-run #{contact} -d #{rootdir} -stdin -s /tmp/find_pacman.sh /bin/bash -c 'cat > find_pacman.sh'`
+ `globus-job-run #{contact} -d #{rootdir} /bin/chmod 755 find_pacman.sh`
+ File.dirname(File.dirname(`globus-job-run #{contact} -d #{rootdir} find_pacman.sh`))
+end
+
def config(args, config_file)
load_config File.open(config_file)
end
More information about the Swift-commit
mailing list