[Swift-commit] r3312 - SwiftApps/adem-osg

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon May 3 14:56:32 CDT 2010


Author: aespinosa
Date: 2010-05-03 14:56:32 -0500 (Mon, 03 May 2010)
New Revision: 3312

Modified:
   SwiftApps/adem-osg/adem-test.rb
   SwiftApps/adem-osg/adem.rb
Log:
Pacman installer and corresponding unit test

Modified: SwiftApps/adem-osg/adem-test.rb
===================================================================
--- SwiftApps/adem-osg/adem-test.rb	2010-05-03 19:56:30 UTC (rev 3311)
+++ SwiftApps/adem-osg/adem-test.rb	2010-05-03 19:56:32 UTC (rev 3312)
@@ -75,6 +75,27 @@
       )
     )
   end
+
+  def test_pacman_install_firefly_jbsim3d
+    # Cleanup target first
+    `globus-job-run ff-grid.unl.edu -env PACMAN_LOCATION=/opt/pacman/pacman-3.28 -d /panfs/panasas/CMS/app/engage /opt/pacman/pacman-3.28/bin/pacman -remove jbsim3d`
+    expected = <<-eos
+  jbsim3d found in http://www.ci.uchicago.edu/~aespinosa/Cybershake...
+  Installing jbsim3d...
+  Downloading jbsim3d_r794~RHEL5_amd64.tar.gz...
+  Untarring jbsim3d_r794~RHEL5_amd64.tar.gz...
+  jbsim3d has been installed.
+    eos
+    assert_equal(
+      expected,
+      pacman_install(
+        "http://www.ci.uchicago.edu/~aespinosa/Cybershake:jbsim3d",
+        { :contact => "ff-grid.unl.edu/jobmanager-fork",
+          :pacman  => "/opt/pacman/pacman-3.28",
+          :path    => "/panfs/panasas/CMS/app/engage" }
+      )
+    )
+  end
 end
 
 class OfflineTest < Test::Unit::TestCase

Modified: SwiftApps/adem-osg/adem.rb
===================================================================
--- SwiftApps/adem-osg/adem.rb	2010-05-03 19:56:30 UTC (rev 3311)
+++ SwiftApps/adem-osg/adem.rb	2010-05-03 19:56:32 UTC (rev 3312)
@@ -117,7 +117,13 @@
     path = "#{site[:app_directory]}/#{conf[:virtual_organization]}"
     contact = site_fork site[:compute_element]
     site[:pacman] = pacman_find(contact, path) if not site[:pacman] 
-    pacman_install contact, path
+    target = {
+      :contact => contact,
+      :pacman => site[:pacman],
+      :path => path
+    }
+    package = "#{conf[:pacman_cache]}:#{app}"
+    pacman_install package, target 
   end
 end
 
@@ -136,6 +142,19 @@
   File.dirname(File.dirname(resp))
 end
 
+def pacman_install(package, target)
+  File.open("pacman_install.sh", "w") do |dump|
+    dump.puts "#!/bin/bash"
+    dump.puts "source #{target[:pacman]}/setup.sh"
+    dump.puts "pacman -trust-all-caches -install #{package}"
+  end
+  File.chmod 0755, "pacman_install.sh"
+  `globus-job-run #{target[:contact]} /bin/mkdir -p #{target[:path]}`
+  resp = `globus-job-run #{target[:contact]} -d #{target[:path]} -stage pacman_install.sh`
+  File.delete "pacman_install.sh"
+  resp
+end
+
 def config(args, config_file)
   load_config File.open(config_file)
 end




More information about the Swift-commit mailing list