Merge remote-tracking branch 'origin/master' into 2049-run-job-from-workbench
authorPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 4 Mar 2014 15:52:00 +0000 (10:52 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 4 Mar 2014 15:52:00 +0000 (10:52 -0500)
27 files changed:
apps/admin/setup-new-user.rb
apps/workbench/app/assets/stylesheets/application.css.scss
doc/_config.yml
doc/_includes/_navbar_top.liquid
doc/install/install-api-server.html.md.liquid
doc/install/install-crunch-dispatch.html.textile.liquid
doc/sdk/python/sdk-python.html.textile.liquid
doc/user/getting_started/check-environment.html.textile.liquid
doc/user/reference/api-tokens.html.textile.liquid
doc/user/reference/sdk-cli.html.textile.liquid
doc/user/tutorials/running-external-program.html.textile.liquid
doc/user/tutorials/tutorial-firstscript.html.textile.liquid
doc/user/tutorials/tutorial-gatk-variantfiltration.html.textile.liquid
doc/user/tutorials/tutorial-job-debug.html.textile.liquid
doc/user/tutorials/tutorial-job1.html.textile.liquid
doc/user/tutorials/tutorial-keep.html.textile.liquid
doc/user/tutorials/tutorial-new-pipeline.html.textile.liquid
doc/user/tutorials/tutorial-parallel.html.textile.liquid
doc/user/tutorials/tutorial-trait-search.html.textile.liquid
sdk/cli/bin/crunch-job
sdk/python/arvados/fuse.py
sdk/python/bin/arv-mount
sdk/ruby/Gemfile.lock
services/api/app/controllers/arvados/v1/jobs_controller.rb
services/api/test/integration/collections_api_test.rb
services/api/test/integration/jobs_api_test.rb [new file with mode: 0644]
services/api/test/test_helper.rb

index 09fd8a76d9ebfc88023c132dc17afa8dabab7031..ab5aa2edf31e031b4a88e65f4aaf85ba4c8537b0 100755 (executable)
@@ -86,14 +86,14 @@ rescue
 end
 log.info { "vm uuid: " + vm[:uuid] }
 
-# Look up the "all users" group (we expect uuid *-*-fffffffffffffff).
+# Look up the "All users" group (we expect uuid *-*-fffffffffffffff).
 group = arv.group.list(where: {name: 'All users'})[:items].select do |g|
   g[:uuid].match /-f+$/
 end.first
 if not group
-  abort "Could not look up the 'all users' group with uuid '*-*-fffffffffffffff'. Stop."
+  abort "Could not look up the 'All users' group with uuid '*-*-fffffffffffffff'. Stop."
 end
-log.info { "\"all users\" group uuid: " + group[:uuid] }
+log.info { "\"All users\" group uuid: " + group[:uuid] }
 
 # Look for signs the user has already been activated / set up.
 
index be54dd01ba1adacd5e02185c25f68fcfccc6d8ab..7a26c709ff678842597383190822b2933ec84ee4 100644 (file)
@@ -158,7 +158,7 @@ li.notification {
     background: rgb(66, 139, 202);
 }
 
-.arvados-nav-active a {
+.arvados-nav-active a, .arvados-nav-active a:hover {
     color: white;
 }
 
index 3e40c589d54fa42310f1d687cf2a2d6aad193920..9a9573472ed0aa3281b7b92cb32d3aced378b2c0 100644 (file)
@@ -1,5 +1,5 @@
 exclude: ["Rakefile", "tmp", "vendor"]
-baseurl: /doc
+baseurl: file:///home/tetron/work/arvados/doc/.site
 arvados_api_host: qr1hi.arvadosapi.com
 
 navbar:
index 9303da2fd3dca022ac738ca976efc69f0be8eb4c..9123893c38b95ce10a493349924171530fa8e5aa 100644 (file)
     </div>
     <div class="collapse navbar-collapse" id="bs-navbar-collapse">
       <ul class="nav navbar-nav">
-        <li {% if page.navsection == 'userguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/user/">User&nbsp;Guide</a></li>
-        <li {% if page.navsection == 'sdk' %} class="active" {% endif %}><a href="{{ site.baseurl }}/sdk/">SDK&nbsp;Reference</a></li>
-        <li {% if page.navsection == 'api' %} class="active" {% endif %}><a href="{{ site.baseurl }}/api/">API&nbsp;Reference</a></li>
-        <li {% if page.navsection == 'adminguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/admin/">Admin Guide</a></li>
-        <li {% if page.navsection == 'installguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/install/">Install Guide</a></li>
+        <li {% if page.navsection == 'userguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/user/index.html">User&nbsp;Guide</a></li>
+        <li {% if page.navsection == 'sdk' %} class="active" {% endif %}><a href="{{ site.baseurl }}/sdk/index.html">SDK&nbsp;Reference</a></li>
+        <li {% if page.navsection == 'api' %} class="active" {% endif %}><a href="{{ site.baseurl }}/api/index.html">API&nbsp;Reference</a></li>
+        <li {% if page.navsection == 'adminguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/admin/index.html">Admin Guide</a></li>
+        <li {% if page.navsection == 'installguide' %} class="active" {% endif %}><a href="{{ site.baseurl }}/install/index.html">Install Guide</a></li>
         <li><a href="https://arvados.org/" style="padding-left: 2em">arvados.org&nbsp;&raquo;</a></li>
       </ul>
     </div>
index f8d66dac5557f65d2746ce1ecb54c0a9c2ca567e..a16e50f94a97e07fb0ad4db70f0a88c29dc30e9c 100644 (file)
@@ -20,9 +20,13 @@ Please follow the instructions on the [Download page](https://arvados.org/projec
 
 ## Configure the API server
 
-First configure the database:
+First install the gems:
 
     cd arvados/services/api
+    bundle install
+
+Next, configure the database:
+
     cp config/database.yml.sample config/database.yml
 
 Edit database.yml to your liking and make sure the database and db user exist.
@@ -48,11 +52,9 @@ and put it in config/initializers/secret_token.rb:
 
     Server::Application.config.secret_token = 'your-new-secret-here'
 
-Finally, edit your
-
-    environments/production.rb
+Finally, edit the main configuration:
 
-file. 
+    cp config/environments/production.rb.example config/environments/production.rb
 
 First, you want to make sure that 
 
index f8cc14321cdb3f9763a287333e56497eb4d67230..4905b45dce0111932fb99d6810a7847f7e1f2821 100644 (file)
@@ -13,6 +13,14 @@ h4. Perl SDK dependencies
 
 * @apt-get install libjson-perl libwww-perl libio-socket-ssl-perl libipc-system-simple-perl@
 
+Add this to @/etc/apt/sources.list@
+
+@deb http://git.oxf.freelogy.org/apt wheezy main contrib@
+
+Then
+
+@apt-get install libwarehouse-perl@
+
 h4. Python SDK dependencies
 
 On controller and all compute nodes:
index 975d6000a78285a18b772fad4b0b32341bb870c9..911f03220691d8798accc811d0c8a26821c8ccbf 100644 (file)
@@ -41,7 +41,7 @@ $ <code class="userinput">sudo python setup.py install</code>
 
 h4. Test installation
 
-If the SDK is installed and your @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ environment variables are set up correctly (see "api-tokens":{{site.basedoc}}/user/reference/api-tokens.html for details), @import arvados@ should produce no errors:
+If the SDK is installed and your @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ environment variables are set up correctly (see "api-tokens":{{site.baseurl}}/user/reference/api-tokens.html for details), @import arvados@ should produce no errors:
 
 <notextile>
 <pre>$ <code class="userinput">python</code>
index 559133dc4a54028a0fc1e7248882f396751d1764..6cf35f340a662bf2816d2e912f81d78c64bc3706 100644 (file)
@@ -8,7 +8,7 @@ title: "Checking your environment"
 
 h1. Checking your environment
 
-First you should "log into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login if you have not already done so.
+First you should "log into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login if you have not already done so.
 
 If @arv user current@ is able to access the API server, it will print out information about your account.  Check that you are able to access the Arvados API server using the following command:
 
@@ -41,6 +41,6 @@ However, if you receive the following message:
 
 bc. ARVADOS_API_HOST and ARVADOS_API_TOKEN need to be defined as environment variables
 
-Then follow the instructions for "getting an API token,":{{site.basedoc}}/user/reference/api-tokens.html and try @arv user current@ again.
+Then follow the instructions for "getting an API token,":{{site.baseurl}}/user/reference/api-tokens.html and try @arv user current@ again.
 
-Once you are able to access the API server, you are ready proceed to the first tutorial: "Storing and retrieving data using Arvados Keep.":{{site.basedoc}}/user/tutorials/tutorial-keep.html
+Once you are able to access the API server, you are ready proceed to the first tutorial: "Storing and retrieving data using Arvados Keep.":{{site.baseurl}}/user/tutorials/tutorial-keep.html
index 4c49d4ae88b15b968430a9670f608c1f19a56b3f..d47c1ccdae42436b8c5bd8b55345a81e26875658 100644 (file)
@@ -14,7 +14,7 @@ Access the Arvados workbench using this link: "https://workbench.{{ site.arvados
 
 (Replace @{{ site.arvados_api_host }}@ with the hostname of your local Arvados instance if necessary.)
 
-First, open a shell on the system on which you intend to use the Arvados client (this may be your local workstation, or an Arvados VM, refer to "Accessing Arvados over ssh":{{site.basedoc}}/user/getting_started/ssh-access.html ) .
+First, open a shell on the system on which you intend to use the Arvados client (this may be your local workstation, or an Arvados VM, refer to "Accessing Arvados over ssh":{{site.baseurl}}/user/getting_started/ssh-access.html ) .
 
 Click on the user icon <span class="glyphicon glyphicon-user"></span> in the upper right corner to access the user settings menu, and click on the menu item _Manage API token_ to go to the "api client authorizations" page.  
 
index f8d3a431a720fcd307be873199e893d95fbd56bc..6d989572716bb3e180130f2c02f1ab6c36058b8e 100644 (file)
@@ -7,7 +7,7 @@ title: "Command line interface"
 
 h1. Reference: Command Line Interface
 
-*First, you should be "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*First, you should be "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 h3. Usage
 
index e7819a194579c23d9fe3b2b9e1529123b4a23fe1..7b31e17818318f178da36b46562f65fc6ff89bd0 100644 (file)
@@ -10,7 +10,7 @@ h1. Running external programs
 
 This tutorial demonstrates how to use Crunch to run an external program by writting a wrapper using the Python SDK.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 In this tutorial, you will use the external program @md5sum@ to compute hashes instead of the built-in Python library used in earlier tutorials.
 
index 41f8a84c3b03200b1ee378453c165811f3da4f54..4c49d19355119bff44d66e04dd538e00a1486651 100644 (file)
@@ -10,7 +10,7 @@ h1. Writing a Crunch script
 
 In this tutorial, we will write the "hash" script demonstrated in the first tutorial.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 This tutorial uses *@you@* to denote your username.  Replace *@you@* with your user name in all the following examples.
 
index e522b6e272fbbc9a9ecfd7891246c18dd53bf506..d69b1225269d20af9402fd2741261f8542a0cec9 100644 (file)
@@ -10,7 +10,7 @@ h1. Using GATK with Arvados
 
 This tutorials demonstrates how to use the Genome Analysis Toolkit (GATK) with Arvados. In this example we will install GATK and then create a VariantFiltration job to assign pass/fail scores to variants in a VCF file.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 h2. Installing GATK
 
index 38ef3be24f7e6a02177e9b1cde72a67861f4af28..28052089b389829368d511df44f00430ffa041f5 100644 (file)
@@ -10,7 +10,7 @@ h1. Debugging a Crunch script
 
 To test changes to a script by running a job, the change must be pushed into @git@, the job queued asynchronously, and the actual execution may be run on any compute server.  As a result, debugging a script can be difficult and time consuming.  This tutorial demonstrates using @arv-crunch-job@ to run your job in your local VM.  This avoids the job queue and allows you to execute the script from your uncomitted git tree.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 This tutorial uses _you_ to denote your username.  Replace _you_ with your user name in all the following examples.
 
index 88478bb4c8317105b01a508debda31573c31eb9a..b66d2e696fa7ecf5e0afb1fc96b8fb18ee50259d 100644 (file)
@@ -10,7 +10,7 @@ h1. Running a crunch job
 
 This tutorial introduces the concepts and use of the Crunch job system using the @arv@ command line tool and Arvados Workbench.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 In "retrieving data using Keep,":tutorial-keep.html we downloaded a file from Keep and did some computation with it (specifically, computing the md5 hash of the complete file).  While a straightforward way to accomplish a computational task, there are several obvious drawbacks to this approach:
 * Large files require significant time to download.
index e02082388f27ab2bc39fa8dff784752526ae8e72..81963638641a71507086a1617e2dc885ab22179d 100644 (file)
@@ -11,7 +11,7 @@ h1. Storing and Retrieving data using Arvados Keep
 This tutorial introduces you to the Arvados file storage system.
 
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 The Arvados distributed file system is called *Keep*.  Keep is a content-addressable file system.  This means that files are managed using special unique identifiers derived from the _contents_ of the file, rather than human-assigned file names (specifically, the md5 hash).  This has a number of advantages:
 * Files can be stored and replicated across a cluster of servers without requiring a central name server.
index 008316691e20e81e129c6d2c32562be0af9907bb..4439641952f4ac92e1e13a05d649e28f71a0bb84 100644 (file)
@@ -10,7 +10,7 @@ h1. Constructing a Crunch pipeline
 
 A pipeline in Arvados is a collection of crunch scripts, in which the output from one script may be used as the input to another script.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 h2. Create a new script
 
@@ -128,7 +128,7 @@ Notice that the pipeline definition explicitly specifies the Keep locator for th
 What if we want to run the pipeline on a different input block?  One option is to define a new pipeline template, but would potentially result in clutter with many pipeline templates defined for one-off jobs.  Instead, you can override values in the input of the component like this:
 
 <notextile>
-<pre><code>$ <span class="userinput">arv pipeline run --template qr1hi-d1hrv-vxzkp38nlde9yyr do_hash::input=33a9f3842b01ea3fdf27cc582f5ea2af</span>
+<pre><code>$ <span class="userinput">arv pipeline run --template qr1hi-d1hrv-vxzkp38nlde9yyr do_hash::input=33a9f3842b01ea3fdf27cc582f5ea2af+242</span>
 2013-12-17 20:31:24 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
 do_hash qr1hi-8i9sb-rffhuay4jryl2n2 queued 2013-12-17T20:31:24Z
 filter  -                           -
index fde36dea4b1d3da6365a7c9933d7c86596c06dee..36ccbcb0341ac1e167c4f9ba95eb006cfb743a5a 100644 (file)
@@ -82,4 +82,4 @@ md5sum.txt
 
 h2. The one job per file pattern
 
-This example demonstrates how to schedule a new task per file.  Because this is a common pattern, the Crunch Python API contains a convenience function to "queue a task for each input file":{{site.basedoc}}/sdk/python/crunch-utility-libraries.html#one_task_per_input which reduces the amount of boilerplate code required to handle parallel jobs.
+This example demonstrates how to schedule a new task per file.  Because this is a common pattern, the Crunch Python API contains a convenience function to "queue a task for each input file":{{site.baseurl}}/sdk/python/crunch-utility-libraries.html#one_task_per_input which reduces the amount of boilerplate code required to handle parallel jobs.
index 13945ff4cd62aaaf68c6f6fab68d688c7496d184..6402c7e1d3fa0cbb19b456e0a6a55b8949214551 100644 (file)
@@ -10,7 +10,7 @@ h1. Querying the Metadata Database
 
 This tutorial introduces the Arvados Metadata Database.  The Metadata Database stores information about files in Keep.  This example will use the Python SDK to find public WGS (Whole Genome Sequencing) data for people who have reported a certain medical condition.
 
-*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.basedoc}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.basedoc}}/user/getting_started/check-environment.html*
+*This tutorial assumes that you are "logged into an Arvados VM instance":{{site.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 In the tutorial examples, three angle brackets (&gt;&gt;&gt;) will be used to denote code to enter at the interactive Python prompt.
 
index e3d0c1dc1f40565ed8e4b6f4f82fbb44d0d6519e..2ba36f2b25ba939957ee3c6fb81baad66797a16e 100755 (executable)
@@ -332,12 +332,11 @@ my $skip_install = ($local_job && $Job->{script_version} =~ m{^/});
 if ($skip_install)
 {
   $ENV{"CRUNCH_SRC"} = $Job->{script_version};
-  system("virtualenv", "$ENV{CRUNCH_TMP}/opt") == 0
-      or croak ("virtualenv $ENV{CRUNCH_TMP}/opt failed: exit ".($?>>8));
-  for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python",
-                    "$ENV{CRUNCH_SRC}/sdk/python") {
+  for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python") {
     if (-d $src_path) {
-      system ("cd $src_path && \$CRUNCH_TMP/opt/bin/python setup.py install")
+      system("virtualenv", "$ENV{CRUNCH_TMP}/opt") == 0
+          or croak ("virtualenv $ENV{CRUNCH_TMP}/opt failed: exit ".($?>>8));
+      system ("cd $src_path && ./build.sh && \$CRUNCH_TMP/opt/bin/python setup.py install")
           == 0
           or croak ("setup.py in $src_path failed: exit ".($?>>8));
     }
@@ -1373,10 +1372,13 @@ open STDOUT, ">", "$destdir.log";
 open STDERR, ">&STDOUT";
 
 mkdir $destdir;
-open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
-print TARX <DATA>;
-if(!close(TARX)) {
-  die "'tar -C $destdir -xf -' exited $?: $!";
+my @git_archive_data = <DATA>;
+if (@git_archive_data) {
+  open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
+  print TARX @git_archive_data;
+  if(!close(TARX)) {
+    die "'tar -C $destdir -xf -' exited $?: $!";
+  }
 }
 
 my $pwd;
@@ -1384,10 +1386,10 @@ chomp ($pwd = `pwd`);
 my $install_dir = $ENV{"CRUNCH_INSTALL"} || "$pwd/opt";
 mkdir $install_dir;
 
-shell_or_die ("virtualenv", $install_dir);
-for my $src_path ("$destdir/arvados/sdk/python", "$destdir/sdk/python") {
+for my $src_path ("$destdir/arvados/sdk/python") {
   if (-d $src_path) {
-    shell_or_die ("cd $src_path && $install_dir/bin/python setup.py install");
+    shell_or_die ("virtualenv", $install_dir);
+    shell_or_die ("cd $src_path && ./build.sh && $install_dir/bin/python setup.py install");
   }
 }
 
index 48e9b2c8739bb6eda30f6ca3adc4f852c0f4fa89..983dc2efbb65748d4c0b5c9e0f47f4c41171470e 100644 (file)
@@ -10,7 +10,6 @@ import errno
 import stat
 import threading
 import arvados
-import argparse
 import pprint
 
 from time import time
index 2424979646b111443bbc536393fcef7adb230d56..ac9cd9bcf6088cbc54751ec340d143b66c423154 100755 (executable)
@@ -3,10 +3,9 @@
 from arvados.fuse import * 
 import arvados
 import subprocess
+import argparse
 
 if __name__ == '__main__':
-    api = arvados.api()
-
     # Handle command line parameters
     parser = argparse.ArgumentParser(
         description='Mount Keep data under the local filesystem.',
index f76ba445be6b09b23aed4f3c7184d28fb70148ca..c71fea02959beec5feb3405be9635335e8129d49 100644 (file)
@@ -1,18 +1,16 @@
 PATH
   remote: .
   specs:
-    arvados (0.1.20140127093947)
+    arvados (0.1.20140228213600)
       activesupport (>= 3.2.13)
       andand
       google-api-client (~> 0.6.3)
       json (>= 1.7.7)
-      minitest (>= 5.0.0)
-      rake
 
 GEM
   remote: https://rubygems.org/
   specs:
-    activesupport (3.2.16)
+    activesupport (3.2.17)
       i18n (~> 0.6, >= 0.6.4)
       multi_json (~> 1.0)
     addressable (2.3.5)
@@ -56,3 +54,5 @@ PLATFORMS
 
 DEPENDENCIES
   arvados!
+  minitest (>= 5.0.0)
+  rake
index 6c45f88e61b1915a955d1e2895c22234965e2657..5c2f5db6cf9683a3b2f6b0904381c42c6e4ddd49 100644 (file)
@@ -42,6 +42,7 @@ class Arvados::V1::JobsController < ApplicationController
   end
 
   def cancel
+    reload_object_before_update
     @object.update_attributes cancelled_at: Time.now
     show
   end
index 076b2342a2a64798efb8e478c444532c1c592d45..1ceedd7dd20face2204a1dd51b9bff75f23d9a38 100644 (file)
@@ -3,10 +3,6 @@ require 'test_helper'
 class CollectionsApiTest < ActionDispatch::IntegrationTest
   fixtures :all
 
-  def jresponse
-    @jresponse ||= ActiveSupport::JSON.decode @response.body
-  end
-
   test "should get index" do
     get "/arvados/v1/collections", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
     assert_response :success
diff --git a/services/api/test/integration/jobs_api_test.rb b/services/api/test/integration/jobs_api_test.rb
new file mode 100644 (file)
index 0000000..1c4e294
--- /dev/null
@@ -0,0 +1,23 @@
+require 'test_helper'
+
+class JobsApiTest < ActionDispatch::IntegrationTest
+  fixtures :all
+
+  test "cancel job" do
+    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
+    assert_response :success
+    assert_equal "arvados#job", jresponse['kind']
+    assert_not_nil jresponse['cancelled_at']
+  end
+
+  test "cancel someone else's visible job" do
+    post "/arvados/v1/jobs/#{jobs(:barbaz).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    assert_response 403
+  end
+
+  test "cancel someone else's invisible job" do
+    post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    assert_response 404
+  end
+
+end
index 8c12ffb5df4718df4c5d19dbd5eae5d109da764a..8e3399523ea800a43c8afaafae38bc10e0066dbf 100644 (file)
@@ -20,5 +20,11 @@ class ActiveSupport::TestCase
   # Add more helper methods to be used by all tests here...
 end
 
+class ActionDispatch::IntegrationTest
+  def jresponse
+    @jresponse ||= ActiveSupport::JSON.decode @response.body
+  end
+end
+
 # Ensure permissions are computed from the test fixtures.
 User.invalidate_permissions_cache