Merge branch 'master' into 2244-sdk-docs
authorTom Clegg <tom@curoverse.com>
Tue, 25 Mar 2014 21:30:37 +0000 (17:30 -0400)
committerTom Clegg <tom@curoverse.com>
Tue, 25 Mar 2014 21:30:37 +0000 (17:30 -0400)
173 files changed:
COPYING [new file with mode: 0644]
LICENSE-2.0.txt [new file with mode: 0644]
README [new file with mode: 0644]
agpl-3.0.txt [new file with mode: 0644]
apps/workbench/Gemfile
apps/workbench/Gemfile.lock
apps/workbench/README.rdoc [deleted file]
apps/workbench/README.textile [new file with mode: 0644]
apps/workbench/app/assets/javascripts/editable.js
apps/workbench/app/controllers/api_client_authorizations_controller.rb
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/controllers/pipeline_templates_controller.rb
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/helpers/provenance_helper.rb
apps/workbench/app/models/arvados_api_client.rb
apps/workbench/app/models/arvados_base.rb
apps/workbench/app/models/arvados_resource_list.rb
apps/workbench/app/views/application/_paging.html.erb [new file with mode: 0644]
apps/workbench/app/views/application/_show_recent.html.erb
apps/workbench/app/views/collections/_show_recent.html.erb
apps/workbench/app/views/groups/_show_recent.html.erb
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/app/views/notifications/_pipelines_notification.html.erb
apps/workbench/app/views/pipeline_instances/_show_recent.html.erb
apps/workbench/app/views/pipeline_templates/_show_recent.html.erb
apps/workbench/app/views/users/_show_activity.html.erb [new file with mode: 0644]
apps/workbench/app/views/users/activity.html.erb [new file with mode: 0644]
apps/workbench/config/application.default.yml
apps/workbench/config/environments/development.rb.example
apps/workbench/config/environments/production.rb.example
apps/workbench/config/environments/test.rb.example
apps/workbench/config/routes.rb
apps/workbench/lib/tasks/config_check.rake
apps/workbench/test/integration/logins_test.rb [new file with mode: 0644]
apps/workbench/test/integration/smoke_test.rb [new file with mode: 0644]
apps/workbench/test/integration/virtual_machines_test.rb [new file with mode: 0644]
apps/workbench/test/integration_helper.rb [new file with mode: 0644]
by-sa-3.0.txt [new file with mode: 0644]
doc/Gemfile
doc/README.textile [new file with mode: 0644]
doc/Rakefile
doc/_config.yml
doc/_includes/_run_md5sum_py.liquid
doc/_includes/_tutorial_hash_script_py.liquid
doc/_includes/_webring.liquid [new file with mode: 0644]
doc/_layouts/default.html.liquid
doc/admin/cheat_sheet.html.textile.liquid
doc/api/authentication.html.textile.liquid
doc/api/index.html.textile.liquid
doc/api/methods.html.textile.liquid
doc/api/methods/api_client_authorizations.html.textile.liquid
doc/api/methods/api_clients.html.textile.liquid
doc/api/methods/authorized_keys.html.textile.liquid
doc/api/methods/collections.html.textile.liquid
doc/api/methods/groups.html.textile.liquid
doc/api/methods/humans.html.textile.liquid
doc/api/methods/job_tasks.html.textile.liquid
doc/api/methods/jobs.html.textile.liquid
doc/api/methods/keep_disks.html.textile.liquid
doc/api/methods/links.html.textile.liquid
doc/api/methods/logs.html.textile.liquid
doc/api/methods/nodes.html.textile.liquid
doc/api/methods/pipeline_instances.html.textile.liquid
doc/api/methods/pipeline_templates.html.textile.liquid
doc/api/methods/repositories.html.textile.liquid
doc/api/methods/specimens.html.textile.liquid
doc/api/methods/traits.html.textile.liquid
doc/api/methods/users.html.textile.liquid
doc/api/methods/virtual_machines.html.textile.liquid
doc/api/permission-model.html.textile.liquid
doc/api/resources.html.textile.liquid
doc/api/schema/ApiClient.html.textile.liquid
doc/api/schema/ApiClientAuthorization.html.textile.liquid
doc/api/schema/AuthorizedKey.html.textile.liquid
doc/api/schema/Collection.html.textile.liquid
doc/api/schema/Commit.html.textile.liquid
doc/api/schema/CommitAncestor.html.textile.liquid
doc/api/schema/Group.html.textile.liquid
doc/api/schema/Human.html.textile.liquid
doc/api/schema/Job.html.textile.liquid
doc/api/schema/JobTask.html.textile.liquid
doc/api/schema/KeepDisk.html.textile.liquid
doc/api/schema/Link.html.textile.liquid
doc/api/schema/Log.html.textile.liquid
doc/api/schema/Node.html.textile.liquid
doc/api/schema/PipelineInstance.html.textile.liquid
doc/api/schema/PipelineTemplate.html.textile.liquid
doc/api/schema/Repository.html.textile.liquid
doc/api/schema/Specimen.html.textile.liquid
doc/api/schema/Trait.html.textile.liquid
doc/api/schema/User.html.textile.liquid
doc/api/schema/VirtualMachine.html.textile.liquid
doc/css/code.css [new file with mode: 0644]
doc/css/nav-list.css
doc/examples/pipeline_templates/gatk-exome-fq-snp.json
doc/index.html.liquid
doc/install/client.html.textile.liquid
doc/install/create-standard-objects.html.textile.liquid
doc/install/index.html.md.liquid
doc/install/install-api-server.html.md.liquid [deleted file]
doc/install/install-api-server.html.textile.liquid [new file with mode: 0644]
doc/install/install-crunch-dispatch.html.textile.liquid
doc/install/install-sso.html.textile.liquid [new file with mode: 0644]
doc/install/install-workbench-app.html.md.liquid [deleted file]
doc/install/install-workbench-app.html.textile.liquid [new file with mode: 0644]
doc/sdk/index.html.textile.liquid
doc/sdk/python/crunch-utility-libraries.html.textile.liquid
doc/sdk/python/sdk-python.html.textile.liquid
doc/user/copying/LICENSE-2.0.html [new file with mode: 0644]
doc/user/copying/agpl-3.0.html [new file with mode: 0644]
doc/user/copying/by-sa-3.0.html [new file with mode: 0644]
doc/user/copying/copying.html.textile.liquid [new file with mode: 0644]
doc/user/examples/crunch-examples.html.textile.liquid
doc/user/getting_started/check-environment.html.textile.liquid
doc/user/getting_started/community.html.textile.liquid
doc/user/getting_started/ssh-access.html.textile.liquid
doc/user/getting_started/workbench.html.textile.liquid
doc/user/index.html.textile.liquid
doc/user/reference/api-tokens.html.textile.liquid
doc/user/reference/sdk-cli.html.textile.liquid
doc/user/topics/keep.html.textile.liquid [new file with mode: 0644]
doc/user/topics/running-pipeline-command-line.html.textile.liquid [new file with mode: 0644]
doc/user/topics/tutorial-gatk-variantfiltration.html.textile.liquid [moved from doc/user/tutorials/tutorial-gatk-variantfiltration.html.textile.liquid with 98% similarity]
doc/user/topics/tutorial-job-debug.html.textile.liquid [moved from doc/user/tutorials/tutorial-job-debug.html.textile.liquid with 95% similarity]
doc/user/topics/tutorial-job1.html.textile.liquid [moved from doc/user/tutorials/tutorial-job1.html.textile.liquid with 74% similarity]
doc/user/topics/tutorial-parallel.html.textile.liquid [moved from doc/user/tutorials/tutorial-parallel.html.textile.liquid with 71% similarity]
doc/user/topics/tutorial-trait-search.html.textile.liquid [moved from doc/user/tutorials/tutorial-trait-search.html.textile.liquid with 99% similarity]
doc/user/tutorials/intro-crunch.html.textile.liquid [new file with mode: 0644]
doc/user/tutorials/running-external-program.html.textile.liquid
doc/user/tutorials/tutorial-firstscript.html.textile.liquid
doc/user/tutorials/tutorial-keep.html.textile.liquid
doc/user/tutorials/tutorial-new-pipeline.html.textile.liquid
doc/user/tutorials/tutorial-pipeline-workbench.html.textile.liquid [new file with mode: 0644]
doc/zenweb-liquid.rb
docker/README.md
sdk/cli/bin/arv
sdk/cli/bin/arv-run-pipeline-instance
sdk/cli/bin/crunch-job
sdk/python/arvados/collection.py
sdk/python/bin/arv-mount
services/api/Gemfile
services/api/Gemfile.lock
services/api/app/controllers/application_controller.rb
services/api/app/controllers/arvados/v1/jobs_controller.rb
services/api/app/controllers/arvados/v1/schema_controller.rb
services/api/app/controllers/arvados/v1/users_controller.rb
services/api/app/controllers/user_sessions_controller.rb
services/api/app/models/arvados_model.rb
services/api/app/models/job.rb
services/api/app/models/user.rb
services/api/config/application.default.yml
services/api/config/application.rb
services/api/config/application.yml.example
services/api/config/database.yml.sample
services/api/config/environments/development.rb.example
services/api/config/environments/production.rb.example
services/api/config/environments/test.rb.example
services/api/config/initializers/omniauth.rb.example
services/api/config/routes.rb
services/api/lib/tasks/config_check.rake
services/api/script/crunch-dispatch.rb
services/api/script/rails
services/api/script/setup-new-user.rb [new file with mode: 0755]
services/api/test/functional/arvados/v1/collections_controller_test.rb
services/api/test/functional/arvados/v1/jobs_controller_test.rb
services/api/test/functional/arvados/v1/keep_disks_controller_test.rb
services/api/test/functional/arvados/v1/schema_controller_test.rb
services/api/test/functional/arvados/v1/users_controller_test.rb
services/api/test/integration/collections_api_test.rb
services/api/test/integration/permissions_test.rb [new file with mode: 0644]
services/api/test/unit/user_test.rb

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..4006e68
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,11 @@
+Server-side components of Arvados contained in the apps/ and services/
+directories, including the API Server, Workbench, and Crunch, are licenced
+under the GNU Affero General Public License version 3 (see agpl-3.0.txt)
+
+The Arvados client Software Development Kits contained in the sdk/ directory,
+example scripts in the crunch_scripts/ directory, and code samples in the
+Aravados documentation are licensed under the Apache License, Version 2.0 (see
+LICENSE-2.0.txt)
+
+The Arvados Documentation located in the doc/ directory is licensed under the
+Creative Commons Attribution-Share Alike 3.0 United States (see by-sa-3.0.txt)
\ No newline at end of file
diff --git a/LICENSE-2.0.txt b/LICENSE-2.0.txt
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..c7a36c3
--- /dev/null
+++ b/README
@@ -0,0 +1,21 @@
+Welcome to Arvados!
+
+The main Arvados web site is 
+  https://arvados.org
+
+The Arvados public wiki is located at 
+  https://arvados.org/projects/arvados/wiki
+
+The Arvados public bug tracker is located at 
+  https://arvados.org/projects/arvados/issues
+
+For support see 
+  http://doc.arvados.org/user/getting_started/community.html
+
+Installation documentation is located at 
+  http://doc.arvados.org/install
+
+If you wish to build the documentation yourself, follow the instructions in
+doc/README to build the documentation, then consult the "Install Guide".
+
+See COPYING for information about Arvados Free Software licenses.
diff --git a/agpl-3.0.txt b/agpl-3.0.txt
new file mode 100644 (file)
index 0000000..dba13ed
--- /dev/null
@@ -0,0 +1,661 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
index 6ae12f75db306278fcb1227f4b711a962f66b84f..b273d9191c875417a9edd5cf90f8ffdf305a007a 100644 (file)
@@ -23,6 +23,13 @@ group :assets do
   gem 'uglifier', '>= 1.0.3'
 end
 
+group :test do
+  gem 'rvm-capistrano'
+  gem 'selenium-webdriver'
+  gem 'capybara'
+  gem 'poltergeist'
+end
+
 gem 'jquery-rails'
 gem 'bootstrap-sass', '~> 3.1.0'
 gem 'bootstrap-x-editable-rails'
@@ -45,8 +52,6 @@ gem 'less-rails'
 # To use debugger
 #gem 'byebug'
 
-gem 'rvm-capistrano', :group => :test
-
 gem 'passenger', :group => :production
 gem 'andand'
 gem 'RedCloth'
index c7ffeb00574af4be2d89aa22589e555bd02e75ff..0c65ca80ffb3d764d6446d4ce714e551a90eb3b1 100644 (file)
@@ -42,6 +42,15 @@ GEM
       net-sftp (>= 2.0.0)
       net-ssh (>= 2.0.14)
       net-ssh-gateway (>= 1.1.0)
+    capybara (2.2.1)
+      mime-types (>= 1.16)
+      nokogiri (>= 1.3.3)
+      rack (>= 1.0.0)
+      rack-test (>= 0.5.4)
+      xpath (~> 2.0)
+    childprocess (0.5.1)
+      ffi (~> 1.0, >= 1.0.11)
+    cliver (0.3.2)
     coffee-rails (3.2.2)
       coffee-script (>= 2.2.0)
       railties (~> 3.2.0)
@@ -54,6 +63,7 @@ GEM
     deep_merge (1.0.1)
     erubis (2.7.0)
     execjs (2.0.2)
+    ffi (1.9.3)
     highline (1.6.20)
     hike (1.2.3)
     httpclient (2.3.4.1)
@@ -73,6 +83,7 @@ GEM
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
     mime-types (1.25)
+    mini_portile (0.5.2)
     multi_json (1.8.2)
     net-scp (1.1.2)
       net-ssh (>= 2.6.5)
@@ -81,6 +92,8 @@ GEM
     net-ssh (2.7.0)
     net-ssh-gateway (1.2.0)
       net-ssh (>= 2.6.5)
+    nokogiri (1.6.1)
+      mini_portile (~> 0.5.0)
     oj (2.1.7)
     passenger (4.0.23)
       daemon_controller (>= 1.1.0)
@@ -90,6 +103,11 @@ GEM
       actionpack
       activesupport
       rails (>= 3.0.0)
+    poltergeist (1.5.0)
+      capybara (~> 2.1)
+      cliver (~> 0.3.1)
+      multi_json (~> 1.0)
+      websocket-driver (>= 0.2.0)
     polyglot (0.3.3)
     rack (1.4.5)
     rack-cache (1.2)
@@ -117,6 +135,7 @@ GEM
     rdoc (3.12.2)
       json (~> 1.4)
     ref (1.0.5)
+    rubyzip (1.1.0)
     rvm-capistrano (1.5.1)
       capistrano (~> 2.15.4)
     sass (3.2.12)
@@ -124,6 +143,11 @@ GEM
       railties (~> 3.2.0)
       sass (>= 3.1.10)
       tilt (~> 1.3)
+    selenium-webdriver (2.40.0)
+      childprocess (>= 0.5.0)
+      multi_json (~> 1.0)
+      rubyzip (~> 1.0)
+      websocket (~> 1.0.4)
     sprockets (2.2.2)
       hike (~> 1.2)
       multi_json (~> 1.0)
@@ -144,6 +168,10 @@ GEM
     uglifier (2.3.1)
       execjs (>= 0.3.0)
       json (>= 1.8.0)
+    websocket (1.0.7)
+    websocket-driver (0.3.2)
+    xpath (2.0.0)
+      nokogiri (~> 1.3)
 
 PLATFORMS
   ruby
@@ -153,6 +181,7 @@ DEPENDENCIES
   andand
   bootstrap-sass (~> 3.1.0)
   bootstrap-x-editable-rails
+  capybara
   coffee-rails (~> 3.2.0)
   deep_merge
   httpclient
@@ -163,10 +192,12 @@ DEPENDENCIES
   oj
   passenger
   piwik_analytics
+  poltergeist
   rails (~> 3.2.0)
   rvm-capistrano
   sass
   sass-rails (~> 3.2.0)
+  selenium-webdriver
   sqlite3
   themes_for_rails
   therubyracer
diff --git a/apps/workbench/README.rdoc b/apps/workbench/README.rdoc
deleted file mode 100644 (file)
index 7c36f23..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-== Welcome to Rails
-
-Rails is a web-application framework that includes everything needed to create
-database-backed web applications according to the Model-View-Control pattern.
-
-This pattern splits the view (also called the presentation) into "dumb"
-templates that are primarily responsible for inserting pre-built data in between
-HTML tags. The model contains the "smart" domain objects (such as Account,
-Product, Person, Post) that holds all the business logic and knows how to
-persist themselves to a database. The controller handles the incoming requests
-(such as Save New Account, Update Product, Show Post) by manipulating the model
-and directing data to the view.
-
-In Rails, the model is handled by what's called an object-relational mapping
-layer entitled Active Record. This layer allows you to present the data from
-database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
-
-The controller and view are handled by the Action Pack, which handles both
-layers by its two parts: Action View and Action Controller. These two layers
-are bundled in a single package due to their heavy interdependence. This is
-unlike the relationship between the Active Record and Action Pack that is much
-more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
-
-
-== Getting Started
-
-1. At the command prompt, create a new Rails application:
-       <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
-
-2. Change directory to <tt>myapp</tt> and start the web server:
-       <tt>cd myapp; rails server</tt> (run with --help for options)
-
-3. Go to http://localhost:3000/ and you'll see:
-       "Welcome aboard: You're riding Ruby on Rails!"
-
-4. Follow the guidelines to start developing your application. You can find
-the following resources handy:
-
-* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
-* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
-
-
-== Debugging Rails
-
-Sometimes your application goes wrong. Fortunately there are a lot of tools that
-will help you debug it and get it back on the rails.
-
-First area to check is the application log files. Have "tail -f" commands
-running on the server.log and development.log. Rails will automatically display
-debugging and runtime information to these files. Debugging info will also be
-shown in the browser on requests from 127.0.0.1.
-
-You can also log your own messages directly into the log file from your code
-using the Ruby logger class from inside your controllers. Example:
-
-  class WeblogController < ActionController::Base
-    def destroy
-      @weblog = Weblog.find(params[:id])
-      @weblog.destroy
-      logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
-    end
-  end
-
-The result will be a message in your log file along the lines of:
-
-  Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
-
-More information on how to use the logger is at http://www.ruby-doc.org/core/
-
-Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
-several books available online as well:
-
-* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
-* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
-
-These two books will bring you up to speed on the Ruby language and also on
-programming in general.
-
-
-== Debugger
-
-Debugger support is available through the debugger command when you start your
-Mongrel or WEBrick server with --debugger. This means that you can break out of
-execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
-
-  class WeblogController < ActionController::Base
-    def index
-      @posts = Post.all
-      debugger
-    end
-  end
-
-So the controller will accept the action, run the first line, then present you
-with a IRB prompt in the server window. Here you can do things like:
-
-  >> @posts.inspect
-  => "[#<Post:0x14a6be8
-          @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
-       #<Post:0x14a6620
-          @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
-  >> @posts.first.title = "hello from a debugger"
-  => "hello from a debugger"
-
-...and even better, you can examine how your runtime objects actually work:
-
-  >> f = @posts.first
-  => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
-  >> f.
-  Display all 152 possibilities? (y or n)
-
-Finally, when you're ready to resume execution, you can enter "cont".
-
-
-== Console
-
-The console is a Ruby shell, which allows you to interact with your
-application's domain model. Here you'll have all parts of the application
-configured, just like it is when the application is running. You can inspect
-domain models, change values, and save to the database. Starting the script
-without arguments will launch it in the development environment.
-
-To start the console, run <tt>rails console</tt> from the application
-directory.
-
-Options:
-
-* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
-  made to the database.
-* Passing an environment name as an argument will load the corresponding
-  environment. Example: <tt>rails console production</tt>.
-
-To reload your controllers and models after launching the console run
-<tt>reload!</tt>
-
-More information about irb can be found at:
-link:http://www.rubycentral.org/pickaxe/irb.html
-
-
-== dbconsole
-
-You can go to the command line of your database directly through <tt>rails
-dbconsole</tt>. You would be connected to the database with the credentials
-defined in database.yml. Starting the script without arguments will connect you
-to the development database. Passing an argument will connect you to a different
-database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
-PostgreSQL and SQLite 3.
-
-== Description of Contents
-
-The default directory structure of a generated Ruby on Rails application:
-
-  |-- app
-  |   |-- assets
-  |       |-- images
-  |       |-- javascripts
-  |       `-- stylesheets
-  |   |-- controllers
-  |   |-- helpers
-  |   |-- mailers
-  |   |-- models
-  |   `-- views
-  |       `-- layouts
-  |-- config
-  |   |-- environments
-  |   |-- initializers
-  |   `-- locales
-  |-- db
-  |-- doc
-  |-- lib
-  |   `-- tasks
-  |-- log
-  |-- public
-  |-- script
-  |-- test
-  |   |-- fixtures
-  |   |-- functional
-  |   |-- integration
-  |   |-- performance
-  |   `-- unit
-  |-- tmp
-  |   |-- cache
-  |   |-- pids
-  |   |-- sessions
-  |   `-- sockets
-  `-- vendor
-      |-- assets
-          `-- stylesheets
-      `-- plugins
-
-app
-  Holds all the code that's specific to this particular application.
-
-app/assets
-  Contains subdirectories for images, stylesheets, and JavaScript files.
-
-app/controllers
-  Holds controllers that should be named like weblogs_controller.rb for
-  automated URL mapping. All controllers should descend from
-  ApplicationController which itself descends from ActionController::Base.
-
-app/models
-  Holds models that should be named like post.rb. Models descend from
-  ActiveRecord::Base by default.
-
-app/views
-  Holds the template files for the view that should be named like
-  weblogs/index.html.erb for the WeblogsController#index action. All views use
-  eRuby syntax by default.
-
-app/views/layouts
-  Holds the template files for layouts to be used with views. This models the
-  common header/footer method of wrapping views. In your views, define a layout
-  using the <tt>layout :default</tt> and create a file named default.html.erb.
-  Inside default.html.erb, call <% yield %> to render the view using this
-  layout.
-
-app/helpers
-  Holds view helpers that should be named like weblogs_helper.rb. These are
-  generated for you automatically when using generators for controllers.
-  Helpers can be used to wrap functionality for your views into methods.
-
-config
-  Configuration files for the Rails environment, the routing map, the database,
-  and other dependencies.
-
-db
-  Contains the database schema in schema.rb. db/migrate contains all the
-  sequence of Migrations for your schema.
-
-doc
-  This directory is where your application documentation will be stored when
-  generated using <tt>rake doc:app</tt>
-
-lib
-  Application specific libraries. Basically, any kind of custom code that
-  doesn't belong under controllers, models, or helpers. This directory is in
-  the load path.
-
-public
-  The directory available for the web server. Also contains the dispatchers and the
-  default HTML files. This should be set as the DOCUMENT_ROOT of your web
-  server.
-
-script
-  Helper scripts for automation and generation.
-
-test
-  Unit and functional tests along with fixtures. When using the rails generate
-  command, template test files will be generated for you and placed in this
-  directory.
-
-vendor
-  External libraries that the application depends on. Also includes the plugins
-  subdirectory. If the app has frozen rails, those gems also go here, under
-  vendor/rails/. This directory is in the load path.
diff --git a/apps/workbench/README.textile b/apps/workbench/README.textile
new file mode 100644 (file)
index 0000000..ea01724
--- /dev/null
@@ -0,0 +1,19 @@
+h1. Developing Workbench
+
+This document includes information to help developers who would like to contribute to Workbench.  If you just want to install it, please refer to our "Workbench installation guide":http://doc.arvados.org/install/install-workbench-app.html.
+
+h2. Running tests
+
+The Workbench application includes a series of integration tests.  When you run these, it starts the API server in a test environment, with all of its fixtures loaded, then tests Workbench by starting that server and making requests against it.
+
+In addition to bundled gems, running the integration tests requires "PhantomJS":http://phantomjs.org/download.html to test JavaScript elements.  The simplest way to get started is to download one of the binary builds provided, and install the executable into one of the directories in your @$PATH@.
+
+If you install the Workbench Bundle in deployment mode, you must also install the API server Bundle in deployment mode, and vice versa.  If your Bundle installs have mismatched modes, the integration tests will fail with "Gem not found" errors.
+
+h2. Writing tests
+
+Integration tests are written with Capybara, which drives a fully-featured Web browser to interact with Workbench exactly as a user would.
+
+If your test requires JavaScript support, your test method should start with the line @Capybara.current_driver = Capybara.javascript_driver@.  Otherwise, Capybara defaults to a simpler browser for speed.
+
+In most tests, you can directly call "Capybara's Session methods":http://rubydoc.info/github/jnicklas/capybara/Capybara/Session to drive the browser and check its state.  If you need finer-grained control, refer to the "full Capybara documentation":http://rubydoc.info/github/jnicklas/capybara/Capybara.
index e37b9444c1615bfd10ce760fa3934f0ab7e76c0d..e6799bf78b40d4a3b3ef0cb4cbcb3c764db82d4d 100644 (file)
@@ -23,3 +23,12 @@ $.fn.editable.defaults.validate = function (value) {
         return "Invalid selection";
     }
 }
+
+$.fn.editabletypes.text.defaults.tpl = '<input type="text" name="editable-text">'
+
+$.fn.editableform.buttons = '\
+<button type="submit" class="btn btn-primary btn-sm editable-submit" \
+  id="editable-submit"><i class="glyphicon glyphicon-ok"></i></button>\
+<button type="button" class="btn btn-default btn-sm editable-cancel" \
+  id="editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>\
+'
index 81e324a46a6b379e5ec06583410d11ec69fcf5bd..24b4ae3185d4701c7152af5a8f582f2e97ecb424 100644 (file)
@@ -1,8 +1,15 @@
 class ApiClientAuthorizationsController < ApplicationController
   def index
-    @objects = model_class.all.to_ary.reject do |x|
+    m = model_class.all
+    items_available = m.items_available
+    offset = m.result_offset
+    limit = m.result_limit
+    filtered = m.to_ary.reject do |x|
       x.api_client_id == 0 or (x.expires_at and x.expires_at < Time.now) rescue false
     end
+    ArvadosApiClient::patch_paging_vars(filtered, items_available, offset, limit)
+    @objects = ArvadosResourceList.new(ApiClientAuthorization)
+    @objects.results= filtered
     super
   end
 
index 412f86ce07a6b874d05b7d5d796bb84a9017bf09..c169be27044ec5db6e0e8da8b67a0e75f8a1cf8d 100644 (file)
@@ -58,7 +58,19 @@ class ApplicationController < ActionController::Base
   end
 
   def index
-    @objects ||= model_class.limit(200).all
+    if params[:limit]
+      limit = params[:limit].to_i
+    else
+      limit = 200
+    end
+
+    if params[:offset]
+      offset = params[:offset].to_i
+    else
+      offset = 0
+    end
+
+    @objects ||= model_class.limit(limit).offset(offset).all
     respond_to do |f|
       f.json { render json: @objects }
       f.html { render }
@@ -149,7 +161,8 @@ class ApplicationController < ActionController::Base
 
   def breadcrumb_page_name
     (@breadcrumb_page_name ||
-     (@object.friendly_link_name if @object.respond_to? :friendly_link_name))
+     (@object.friendly_link_name if @object.respond_to? :friendly_link_name) ||
+     action_name)
   end
 
   def index_pane_list
@@ -320,14 +333,14 @@ class ApplicationController < ActionController::Base
     }
   }
 
-  @@notification_tests.push lambda { |controller, current_user|
-    Job.limit(1).where(created_by: current_user.uuid).each do
-      return nil
-    end
-    return lambda { |view|
-      view.render partial: 'notifications/jobs_notification'
-    }
-  }
+  #@@notification_tests.push lambda { |controller, current_user|
+  #  Job.limit(1).where(created_by: current_user.uuid).each do
+  #    return nil
+  #  end
+  #  return lambda { |view|
+  #    view.render partial: 'notifications/jobs_notification'
+  #  }
+  #}
 
   @@notification_tests.push lambda { |controller, current_user|
     Collection.limit(1).where(created_by: current_user.uuid).each do
index 737583a31e68c6d6ab64b40ba298bafe0832dd41..01abbb4ee06828f8cf7b529f6bbf77b9bdead716 100644 (file)
@@ -12,7 +12,19 @@ class CollectionsController < ApplicationController
                       Collection.where(any: ['contains', params[:search]])).
         uniq { |c| c.uuid }
     else
-      @collections = Collection.limit(100)
+      if params[:limit]
+        limit = params[:limit].to_i
+      else
+        limit = 100
+      end
+
+      if params[:offset]
+        offset = params[:offset].to_i
+      else
+        offset = 0
+      end
+
+      @collections = Collection.limit(limit).offset(offset)
     end
     @links = Link.limit(1000).
       where(head_uuid: @collections.collect(&:uuid))
@@ -105,7 +117,7 @@ class CollectionsController < ApplicationController
       puts request
       @prov_svg = ProvenanceHelper::create_provenance_graph(u.provenance, "provenance_svg", 
                                                             {:request => request,
-                                                              :direction => :top_down
+                                                              :direction => :bottom_up
                                                               :combine_jobs => :script_only}) rescue nil
       @used_by_svg = ProvenanceHelper::create_provenance_graph(u.used_by, "used_by_svg", 
                                                                {:request => request,
index 98101b5e9b0953b61060a554d54456d8c37b7841..5173d4e376b9a2ae244ca90d05b3130f3e2e06d7 100644 (file)
@@ -1,10 +1,7 @@
 class PipelineTemplatesController < ApplicationController
   
   def show
-    @objects = [] 
-    PipelineInstance.where(pipeline_template_uuid: @object.uuid).each do |pipeline|
-      @objects.push(pipeline)
-    end
+    @objects = PipelineInstance.where(pipeline_template_uuid: @object.uuid)
     super
   end
 
index c33de2d034a1630b56a3ca0000aa87440ad82c7a..35c9660d6ccdf55a29b165efecd3cb402ceb9e96 100644 (file)
@@ -1,5 +1,5 @@
 class UsersController < ApplicationController
-  skip_before_filter :find_object_by_uuid, :only => :welcome
+  skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity]
   skip_around_filter :thread_with_mandatory_api_token, :only => :welcome
   before_filter :ensure_current_user_is_admin, only: :sudo
 
@@ -10,6 +10,59 @@ class UsersController < ApplicationController
     end
   end
 
+  def activity
+    @breadcrumb_page_name = nil
+    @users = User.all
+    @user_activity = {}
+    @activity = {
+      logins: {},
+      jobs: {},
+      pipeline_instances: {}
+    }
+    @total_activity = {}
+    @spans = [['This week', Time.now.beginning_of_week, Time.now],
+              ['Last week',
+               Time.now.beginning_of_week.advance(weeks:-1),
+               Time.now.beginning_of_week],
+              ['This month', Time.now.beginning_of_month, Time.now],
+              ['Last month',
+               1.month.ago.beginning_of_month,
+               Time.now.beginning_of_month]]
+    @spans.each do |span, threshold_start, threshold_end|
+      @activity[:logins][span] = Log.
+        filter([[:event_type, '=', 'login'],
+                [:object_kind, '=', 'arvados#user'],
+                [:created_at, '>=', threshold_start],
+                [:created_at, '<', threshold_end]])
+      @activity[:jobs][span] = Job.
+        filter([[:created_at, '>=', threshold_start],
+                [:created_at, '<', threshold_end]])
+      @activity[:pipeline_instances][span] = PipelineInstance.
+        filter([[:created_at, '>=', threshold_start],
+                [:created_at, '<', threshold_end]])
+      @activity.each do |type, act|
+        records = act[span]
+        @users.each do |u|
+          @user_activity[u.uuid] ||= {}
+          @user_activity[u.uuid][span + ' ' + type.to_s] ||= 0
+        end
+        records.each do |record|
+          @user_activity[record.modified_by_user_uuid] ||= {}
+          @user_activity[record.modified_by_user_uuid][span + ' ' + type.to_s] ||= 0
+          @user_activity[record.modified_by_user_uuid][span + ' ' + type.to_s] += 1
+          @total_activity[span + ' ' + type.to_s] ||= 0
+          @total_activity[span + ' ' + type.to_s] += 1
+        end
+      end
+    end
+    @users = @users.sort_by do |a|
+      [-@user_activity[a.uuid].values.inject(:+), a.full_name]
+    end
+    # Prepend a "Total" pseudo-user to the sorted list
+    @user_activity[nil] = @total_activity
+    @users = [OpenStruct.new(uuid: nil)] + @users
+  end
+
   def show_pane_list
     if current_user.andand.is_admin
       super | %w(Admin)
@@ -18,6 +71,14 @@ class UsersController < ApplicationController
     end
   end
 
+  def index_pane_list
+    if current_user.andand.is_admin
+      super | %w(Activity)
+    else
+      super
+    end
+  end
+
   def sudo
     resp = $arvados_api_client.api(ApiClientAuthorization, '', {
                                      api_client_authorization: {
index e608572f05f23495e4f15f886582f7adc637b8c8..9066224b7e80e473328bf7fcda8da6ceece8209f 100644 (file)
@@ -59,11 +59,15 @@ module ApplicationHelper
         link_name = link_uuid
 
         if opts[:friendly_name]
-          begin
-            link_name = resource_class.find(link_uuid).friendly_link_name
-          rescue RuntimeError
-            # If that lookup failed, the link will too. So don't make one.
-            return attrvalue
+          if attrvalue.respond_to? :friendly_link_name
+            link_name = attrvalue.friendly_link_name
+          else
+            begin
+              link_name = resource_class.find(link_uuid).friendly_link_name
+            rescue RuntimeError
+              # If that lookup failed, the link will too. So don't make one.
+              return attrvalue
+            end
           end
         end
         if opts[:with_class_name]
index c0b2fd36f814d0be75c01343f7b071cdf62fff2e..66754d20b2f209248270d7ca73cedb0b5e758554 100644 (file)
@@ -26,6 +26,14 @@ module ProvenanceHelper
       end
     end
 
+    def url_for u
+      p = { :host => @opts[:request].host, 
+        :port => @opts[:request].port,
+        :protocol => @opts[:request].protocol }
+      p.merge! u
+      Rails.application.routes.url_helpers.url_for (p)      
+    end 
+
     def determine_fillcolor(n)
       fillcolor = %w(aaaaaa aaffaa aaaaff aaaaaa ffaaaa)[n || 0] || 'aaaaaa'
       "style=filled,fillcolor=\"##{fillcolor}\""
@@ -37,11 +45,9 @@ module ProvenanceHelper
 
       rsc = ArvadosBase::resource_class_for_uuid uuid.to_s
       if rsc
-        href = Rails.application.routes.url_helpers.url_for ({:controller => rsc.to_s.tableize, 
-                                                               :action => :show, 
-                                                               :id => uuid.to_s, 
-                                                               :host => @opts[:request].host, 
-                                                               :port => @opts[:request].port})
+        href = url_for ({:controller => rsc.to_s.tableize, 
+                          :action => :show, 
+                          :id => uuid.to_s })
       
         #"\"#{uuid}\" [label=\"#{rsc}\\n#{uuid}\",href=\"#{href}\"];\n"
         if rsc == Collection
@@ -80,8 +86,8 @@ module ProvenanceHelper
               end
             end  
           end
-          return "\"#{uuid}\" [label=\"#{rsc}\",href=\"#{href}\",#{bgcolor}];\n"
         end
+        return "\"#{uuid}\" [label=\"#{rsc}\",href=\"#{href}\",#{bgcolor}];\n"
       end
       "\"#{uuid}\" [#{bgcolor}];\n"
     end
@@ -227,11 +233,9 @@ module ProvenanceHelper
 
       @pdata.each do |k, link|
         if link[:head_uuid] == uuid.to_s and link[:link_class] == "provenance"
-          href = Rails.application.routes.url_helpers.url_for ({:controller => Link.to_s.tableize, 
-                                                                 :action => :show, 
-                                                                 :id => link[:uuid], 
-                                                                 :host => @opts[:request].host, 
-                                                                 :port => @opts[:request].port})
+          href = url_for ({:controller => Link.to_s.tableize, 
+                            :action => :show, 
+                            :id => link[:uuid] })
 
           gr += describe_node(link[:tail_uuid])
           gr += edge(link[:head_uuid], link[:tail_uuid], {:label => link[:name], :href => href}) 
@@ -247,10 +251,8 @@ module ProvenanceHelper
     def describe_jobs
       gr = ""
       @jobs.each do |k, v|
-        href = Rails.application.routes.url_helpers.url_for ({:controller => Job.to_s.tableize, 
-                                                               :action => :index, 
-                                                               :host => @opts[:request].host, 
-                                                               :port => @opts[:request].port})
+        href = url_for ({:controller => Job.to_s.tableize, 
+                          :action => :index })
 
         gr += "\"#{k}\" [href=\"#{href}?"
         
index 84735d9774c60f902896d3a15f5ae6850fb977c7..2f83a411522b736e216d7e4af04962ae9b1e4d05 100644 (file)
@@ -90,14 +90,26 @@ class ArvadosApiClient
     resp
   end
 
+  def self.patch_paging_vars(ary, items_available, offset, limit)
+    if items_available
+      (class << ary; self; end).class_eval { attr_accessor :items_available }
+      ary.items_available = items_available
+    end
+    if offset
+      (class << ary; self; end).class_eval { attr_accessor :offset }
+      ary.offset = offset
+    end
+    if limit
+      (class << ary; self; end).class_eval { attr_accessor :limit }
+      ary.limit = limit
+    end    
+    ary
+  end
+
   def unpack_api_response(j, kind=nil)
     if j.is_a? Hash and j[:items].is_a? Array and j[:kind].match(/(_list|List)$/)
       ary = j[:items].collect { |x| unpack_api_response x, j[:kind] }
-      if j[:items_available]
-        (class << ary; self; end).class_eval { attr_accessor :items_available }
-        ary.items_available = j[:items_available]
-      end
-      ary
+      ArvadosApiClient::patch_paging_vars(ary, j[:items_available], j[:offset], j[:limit])
     elsif j.is_a? Hash and (kind || j[:kind])
       oclass = self.kind_class(kind || j[:kind])
       if oclass
@@ -137,10 +149,6 @@ class ArvadosApiClient
     Rails.configuration.arvados_v1_base
   end
 
-  def arvados_schema
-    @arvados_schema ||= api 'schema', ''
-  end
-
   def discovery
     @discovery ||= api '../../discovery/v1/apis/arvados/v1/rest', ''
   end
index fbf7ee5e799e48a07c831d553733b8c56bca9855..3c224aaba0560f492f923e138da7b421c3a17d59 100644 (file)
@@ -45,20 +45,25 @@ class ArvadosBase < ActiveRecord::Base
     return @columns unless @columns.nil?
     @columns = []
     @attribute_info ||= {}
-    return @columns if $arvados_api_client.arvados_schema[self.to_s.to_sym].nil?
-    $arvados_api_client.arvados_schema[self.to_s.to_sym].each do |coldef|
-      k = coldef[:name].to_sym
-      if coldef[:type] == coldef[:type].downcase
-        @columns << column(k, coldef[:type].to_sym)
+    schema = $arvados_api_client.discovery[:schemas][self.to_s.to_sym]
+    return @columns if schema.nil?
+    schema[:properties].each do |k, coldef|
+      case k
+      when :etag, :kind
+        attr_reader k
       else
-        @columns << column(k, :text)
-        serialize k, coldef[:type].constantize
+        if coldef[:type] == coldef[:type].downcase
+          # boolean, integer, etc.
+          @columns << column(k, coldef[:type].to_sym)
+        else
+          # Hash, Array
+          @columns << column(k, :text)
+          serialize k, coldef[:type].constantize
+        end
+        attr_accessible k
+        @attribute_info[k] = coldef
       end
-      attr_accessible k
-      @attribute_info[k] = coldef
     end
-    attr_reader :etag
-    attr_reader :kind
     @columns
   end
 
@@ -92,6 +97,10 @@ class ArvadosBase < ActiveRecord::Base
     ArvadosResourceList.new(self).order(*args)
   end
 
+  def self.filter(*args)
+    ArvadosResourceList.new(self).filter(*args)
+  end
+
   def self.where(*args)
     ArvadosResourceList.new(self).where(*args)
   end
index 72495cfdb99caec2269d5fc681e5cbb3944cea6f..16a59b173e680ed39fd6e9f58b7f2adf6fb857d6 100644 (file)
@@ -15,11 +15,22 @@ class ArvadosResourceList
     self
   end
 
+  def offset(skip)
+    @offset = skip
+    self
+  end
+
   def order(orderby_spec)
     @orderby_spec = orderby_spec
     self
   end
 
+  def filter _filters
+    @filters ||= []
+    @filters += _filters
+    self
+  end
+
   def where(cond)
     cond = cond.dup
     cond.keys.each do |uuid_key|
@@ -51,7 +62,9 @@ class ArvadosResourceList
     }
     api_params[:eager] = '1' if @eager
     api_params[:limit] = @limit if @limit
+    api_params[:offset] = @offset if @offset
     api_params[:order] = @orderby_spec if @orderby_spec
+    api_params[:filters] = @filters if @filters
     res = $arvados_api_client.api @resource_class, '', api_params
     @results = $arvados_api_client.unpack_api_response res
     self
@@ -62,6 +75,10 @@ class ArvadosResourceList
     @results
   end
 
+  def results=(r)
+    @results = r
+  end
+
   def all
     where({})
   end
@@ -108,4 +125,13 @@ class ArvadosResourceList
   def items_available
     results.items_available if results.respond_to? :items_available
   end
+
+  def result_limit
+    results.limit if results.respond_to? :limit
+  end
+
+  def result_offset
+    results.offset if results.respond_to? :offset
+  end
+
 end
diff --git a/apps/workbench/app/views/application/_paging.html.erb b/apps/workbench/app/views/application/_paging.html.erb
new file mode 100644 (file)
index 0000000..df9d08d
--- /dev/null
@@ -0,0 +1,126 @@
+<% content_for :css do %>
+.index-paging {
+text-align: center;
+padding-left: 1em;
+padding-right: 1em;
+background-color: whitesmoke;
+}
+.paging-number {
+display: inline-block;
+min-width: 1.2em;
+}
+<% end %>
+
+<% if results.respond_to? :result_offset and
+       results.respond_to? :result_limit and
+       results.respond_to? :items_available and
+       results.result_offset != nil and
+       results.result_limit != nil and
+       results.items_available != nil 
+%>
+<div class="index-paging">
+  Displaying <%= results.result_offset+1 %> &ndash; 
+  <%= if results.result_offset + results.result_limit > results.items_available 
+        results.items_available 
+      else 
+        results.result_offset + results.result_limit 
+      end %>
+ out of <%= results.items_available %>
+</div>
+
+<% if not (results.result_offset == 0 and results.items_available <= results.result_limit) %>
+  
+<div class="index-paging">
+
+<% if results.result_offset > 0 %>
+  <% if results.result_offset > results.result_limit %>
+    <% prev_offset = results.result_offset - results.result_limit %>
+  <% else %>
+    <% prev_offset = 0 %>
+  <% end %>
+<% else %>
+  <% prev_offset = nil %>
+<% end %>
+
+<% this_offset = results.result_offset %>
+
+<% if (results.result_offset + results.result_limit) < results.items_available %>
+  <% next_offset = results.result_offset + results.result_limit %>
+<% else %>
+  <% next_offset = nil %>
+<% end %>
+
+<span class="pull-left">
+<% if results.result_offset > 0 %>
+  <%= link_to raw("<span class='glyphicon glyphicon-fast-backward'></span>"), {:id => object, :offset => 0, :limit => results.result_limit}  %>
+<% else %>
+  <span class='glyphicon glyphicon-fast-backward text-muted'></span>  
+<% end %>
+
+<% if prev_offset %>
+  <%= link_to raw("<span class='glyphicon glyphicon-step-backward'></span>"), {:id => object, :offset => prev_offset, :limit => results.result_limit}  %>
+<% else %>
+<span class='glyphicon glyphicon-step-backward text-muted'></span>
+<% end %>
+</span>
+
+<% first = this_offset - (10 * results.result_limit) %>
+<% last = this_offset + (11 * results.result_limit) %>
+
+<% lastpage_offset = (results.items_available / results.result_limit) * results.result_limit %>
+
+<% if last > results.items_available %>
+  <% first -= (last - lastpage_offset) %>
+  <% last -= (last - results.items_available) %>
+<% end %>
+
+<% if first < 0 %>
+  <% d = -first %>
+  <% first += d %>
+  <% last += d %>
+<% end %>
+
+<% last = results.items_available if last > results.items_available %>
+
+<% i = first %>
+<% n = first / results.result_limit %>
+
+<% if first > 0 %>
+&hellip;
+<% end %>
+
+<% while i < last %>
+<% if i != this_offset %>
+  <%= link_to "#{n+1}", {:id => @object, :offset => i, :limit => results.result_limit}, class: 'paging-number' %>
+<% else %>
+  <span class="paging-number" style="font-weight: bold;"><%= n+1 %></span>
+<% end %>
+<% i += results.result_limit %>
+<% n += 1 %>
+<% end %>
+
+<% if last < results.items_available %>
+&hellip;
+<% end %>
+
+<span class="pull-right">
+<% if next_offset %>
+  <%= link_to raw("<span class='glyphicon glyphicon-step-forward'></span>"), {:id => @object, :offset => next_offset, :limit => results.result_limit}  %>
+<% else %>
+<span class='glyphicon glyphicon-forward text-muted'></span>
+<% end %>
+
+<% if (results.items_available - results.result_offset) >= results.result_limit %>
+  <%= link_to raw("<span class='glyphicon glyphicon-fast-forward'></span>"), {:id => @object, :offset => results.items_available - (results.items_available % results.result_limit), 
+        :limit => results.result_limit}  %>
+<% else %>
+  <span class='glyphicon glyphicon-fast-forward text-muted'></span>  
+<% end %>
+
+</span>
+
+</div>
+
+<% end %>
+
+<% end %>
index ef4a8d1f041b5c91f00ea5e947059377c4aad185..04387ffb3e9d8e45227f69e7ce85f2deadb14f35 100644 (file)
@@ -8,6 +8,8 @@
 
 <% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at' %>
 
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+
 <%= form_tag do |f| %>
 
 <table class="table table-condensed arv-index">
@@ -63,4 +65,6 @@
 
 <% end %>
 
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+
 <% end %>
index a3b93d84e67aa9739b95592543bade636f4e0aaf..e0a12ffbf63ab9e34286744dd867e99422510685 100644 (file)
 </div>
 <% end %>
 
+<%= render partial: "paging", locals: {results: @collections, object: @object} %>
+
 <div style="padding-right: 1em">
 
 <%= form_tag do |f| %>
 
-<table id="collections-index" class="topalign table table-condensed table-fixedlayout table-fixed-header-row">
+<table id="collections-index" class="topalign table table-condensed table-fixedlayout"> <!-- table-fixed-header-row -->
   <colgroup>
     <col width="4%" />
     <col width="10%" />
@@ -47,6 +49,8 @@
 
 </div>
 
+<%= render partial: "paging", locals: {results: @collections, object: @object} %>
+
 <% content_for :footer_js do %>
 $(document).on('click', 'form[data-remote] input[type=submit]', function() {
   $('table#collections-index tbody').fadeTo(200, 0.3);
index c372b885926664d6e0cbcd4af31e39d683fb6edb..c709e89bc82e3b1983d41b05b8e390ce980594e3 100644 (file)
@@ -1,3 +1,5 @@
+<%= render partial: "paging", locals: {results: @groups, object: @object} %>
+
 <table class="table table-hover">
   <thead>
     <tr class="contain-align-left">
@@ -36,3 +38,5 @@
 
   </tbody>
 </table>
+
+<%= render partial: "paging", locals: {results: @groups, object: @object} %>
index abef47136fd21dd90ae67cf246b51431344ef7b8..63cf67c263f8b0f5eeb20be7c5add52e3acf0a31 100644 (file)
         -->
 
         <li class="dropdown notification-menu">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="collections-menu">
             <span class="glyphicon glyphicon-paperclip"></span>
             <span class="badge" id="persistent-selection-count"></span>
             <span class="caret"></span>
 
         <% if current_user.is_active %>
         <li class="dropdown notification-menu">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
             <span class="glyphicon glyphicon-envelope"></span>
             <span class="badge badge-alert notification-count"><%= @notification_count %></span>
             <span class="caret"></span>
         <% end %>
 
         <li class="dropdown">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="user-menu">
             <span class="glyphicon glyphicon-user"></span><span class="caret"></span>
           </a>
           <ul class="dropdown-menu" role="menu">
index 143c1a06d0b1920495c33454056d7e9b27695236..781b9073eec9b9a4161028565c5e40335f674b23 100644 (file)
@@ -1,7 +1,7 @@
   <p><%= image_tag "dax.png", class: "dax" %>
     Hi, I noticed you haven't run a pipeline yet.  
     <%= link_to "Click here to learn how to run an Arvados Crunch pipeline.", 
-       "#{Rails.configuration.arvados_docsite}/user/tutorials/tutorial-new-pipeline.html", 
+       "#{Rails.configuration.arvados_docsite}/user/tutorials/tutorial-pipeline-workbench.html",
        style: "font-weight: bold",
        target: "_blank" %>
   </p>
index 09eae0f35122f760b2d72de3c618e4eaca92b407..f7dc138162320bfb2c153f8fa001456190d10549 100644 (file)
@@ -5,6 +5,8 @@
 <% end rescue nil %>
 <% end %>
 
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+
 <%= form_tag do |f| %>
 
 <table class="table table-condensed table-fixedlayout">
@@ -71,6 +73,8 @@
 
 <% end %>
 
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+
 <% content_for :footer_js do %>
 var showhide_compare = function() {
     var form = $('form#compare')[0];
index 342a74331e567f9bc7fd7a7e7f1380b5b87161de..3ea7d8c79b0d906b3c9d499045dfde3c79f8ffd6 100644 (file)
@@ -11,6 +11,8 @@
   }
 <% end %>
 
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
+
 <table class="table table-hover">
   <thead>
     <tr class="contain-align-left">
@@ -54,3 +56,5 @@
 
   </tbody>
 </table>
+
+<%= render partial: "paging", locals: {results: @objects, object: @object} %>
diff --git a/apps/workbench/app/views/users/_show_activity.html.erb b/apps/workbench/app/views/users/_show_activity.html.erb
new file mode 100644 (file)
index 0000000..ea53307
--- /dev/null
@@ -0,0 +1,4 @@
+<p>
+  As an admin user, you can <%= link_to "view recent user activity", activity_users_url %>.
+</p>
+
diff --git a/apps/workbench/app/views/users/activity.html.erb b/apps/workbench/app/views/users/activity.html.erb
new file mode 100644 (file)
index 0000000..eaf296a
--- /dev/null
@@ -0,0 +1,72 @@
+<% content_for :css do %>
+table#users-activity-table th {
+    overflow-x: hidden;
+}
+table#users-activity-table .cell-for-span-This-month,
+table#users-activity-table .cell-for-span-Last-month {
+    background: #eee;
+}
+<% end %>
+<table class="table table-condensed arv-index" id="users-activity-table">
+  <colgroup>
+    <col width="28%" />
+  </colgroup>
+  <% @spans.each do |_| %>
+  <colgroup>
+    <% 3.times do %>
+    <col width="<%= (72 / @spans.count / 3).floor %>%" />
+    <% end %>
+  </colgroup>
+  <% end %>
+
+  <tr>
+    <th rowspan="2">User</th>
+    <% @spans.each do |span, start_at, end_at| %>
+    <th colspan="3" class="cell-for-span-<%= span.gsub ' ','-' %>">
+      <%= span %>
+      <br />
+      <%= start_at.strftime('%b %-d') %>
+      -
+      <%= (end_at-1.second).strftime('%b %-d') %>
+    </th>
+    <% end %>
+  </tr>
+  <tr>
+    <% @spans.each do |span, _| %>
+    <th class="cell-for-span-<%= span.gsub ' ','-' %>">Logins</th>
+    <th class="cell-for-span-<%= span.gsub ' ','-' %>">Jobs</th>
+    <th class="cell-for-span-<%= span.gsub ' ','-' %>">Pipelines</th>
+    <% end %>
+  </tr>
+
+  <% @users.each do |user| %>
+  <tr>
+    <td>
+      <small>
+       <% if user.uuid %>
+       <%= link_to_if_arvados_object user, friendly_name: true %>
+       <% else %>
+       <b>Total</b>
+       <% end %>
+      </small>
+    </td>
+
+    <% @spans.each do |span, _| %>
+    <% ['logins', 'jobs', 'pipeline_instances'].each do |type| %>
+    <td class="cell-for-span-<%= span.gsub ' ','-' %>">
+      <small>
+       <%= @user_activity[user.uuid][span + " " + type].to_s %>
+      </small>
+    </td>
+    <% end %>
+    <% end %>
+  </tr>
+  <% end %>
+</table>
+
+<% content_for :footer_js do %>
+$('#users-activity-table td small').each(function(){
+    if ($(this).html().trim() == '0')
+       $(this).css('opacity', '0.3');
+});
+<% end %>
index 139255214f49c278d786ffe93e018a1c6d6686e7..bbed01ea315b064d1cd2ea2db49b1e433fb32967 100644 (file)
@@ -1,4 +1,4 @@
-# Do not use this file for site configuration. Create config.yml
+# Do not use this file for site configuration. Create application.yml
 # instead (see application.yml.example).
 
 development:
@@ -14,7 +14,7 @@ development:
   assets.compress: false
   assets.debug: true
   profiling_enabled: true
-  site_name: Workbench:dev
+  site_name: Arvados Workbench (dev)
 
 production:
   force_ssl: true
@@ -51,6 +51,14 @@ test:
   profiling_enabled: false
   secret_token: <%= rand(2**256).to_s(36) %>
 
+  # When you run the Workbench's integration tests, it starts the API
+  # server as a dependency.  These settings should match the API
+  # server's Rails defaults.  If you adjust those, change these
+  # settings in application.yml to match.
+  arvados_login_base: https://localhost:3001/login
+  arvados_v1_base: https://localhost:3001/arvados/v1
+  arvados_insecure_https: true
+
   site_name: Workbench:test
 
 common:
index ba3dbbe30d868cea5778ec498d243d6abdbe3ed1..389a25420f1b31eb75290dec3d435acf551e62f7 100644 (file)
@@ -35,24 +35,4 @@ ArvadosWorkbench::Application.configure do
   # Expands the lines which load the assets
   config.assets.debug = true
 
-  # Log timing data for API transactions
-  config.profiling_enabled = true
-
-  config.arvados_login_base = 'http://arvados.local/login'
-  config.arvados_v1_base = 'http://arvados.local/arvados/v1'
-  config.arvados_insecure_https = true # true = do not check server certificate
-
-  config.data_import_dir = '/tmp/arvados-workbench-upload'
-  config.data_export_dir = '/tmp/arvados-workbench-download'
-
-  config.secret_token = File.read('config/.secret_token') if File.exist? 'config/.secret_token'
-
-  config.site_name = 'Arvados Workbench (dev)'
-  config.activation_contact_link = 'mailto:info@arvados.org'
-
-  config.arvados_docsite = 'http://doc.arvados.org'
-
-  config.arvados_theme = 'default'
-
-  config.show_user_agreement_inline = false
 end
index 2b4a39f963cd9039a9f302ba124349bdaa972f0e..bb7595454e381abd82ff3f740802274320882503 100644 (file)
@@ -68,23 +68,4 @@ ArvadosWorkbench::Application.configure do
   # Log timing data for API transactions
   config.profiling_enabled = false
 
-  config.arvados_login_base = 'https://arvados.local/login'
-  config.arvados_v1_base = 'https://arvados.local/arvados/v1'
-  config.arvados_insecure_https = false # true = do not check server certificate
-
-  config.data_import_dir = '/data/arvados-workbench-upload/data'
-  config.data_export_dir = '/data/arvados-workbench-download/data'
-
-  # Authentication stub: hard code pre-approved API tokens.
-  # config.accept_api_token = { rand(2**256).to_s(36) => true }
-  config.accept_api_token = {}
-
-  config.site_name = 'Arvados Workbench'
-  config.activation_contact_link = 'mailto:info@arvados.org'
-
-  config.arvados_docsite = 'http://doc.arvados.org'
-
-  config.arvados_theme = 'default'
-
-  config.show_user_agreement_inline = false
 end
index c4a5d229169200382950a33228eab3cec7cc70a2..b3cb72aff258b8d9b5946cc1cd9fa1865cfe4cd1 100644 (file)
@@ -38,23 +38,4 @@ ArvadosWorkbench::Application.configure do
   # Log timing data for API transactions
   config.profiling_enabled = false
 
-  config.arvados_login_base = 'http://arvados.local/login'
-  config.arvados_v1_base = 'https://arvados.local/arvados/v1'
-  config.arvados_insecure_https = true # true = do not check server certificate
-
-  config.data_import_dir = '/data/arvados-workbench-upload'
-  config.data_export_dir = '/data/arvados-workbench-download'
-
-  # Authentication stub: hard code pre-approved API tokens.
-  # config.accept_api_token = { rand(2**256).to_s(36) => true }
-  config.accept_api_token = {}
-
-  config.site_name = 'Arvados Workbench (test)'
-  config.activation_contact_link = 'mailto:info@arvados.org'
-
-  config.arvados_docsite = 'http://doc.arvados.org'
-
-  config.arvados_theme = 'default'
-
-  config.show_user_agreement_inline = false
 end
index 617679eb33b69a48b47ad1a323a8060a8e5dde96..0981d2ea37689e7b99635ed8bd1747e4fb409f93 100644 (file)
@@ -2,8 +2,10 @@ ArvadosWorkbench::Application.routes.draw do
   themes_for_rails
 
   resources :keep_disks
-  resources :user_agreements
-  post '/user_agreements/sign' => 'user_agreements#sign'
+  resources :user_agreements do
+    put 'sign', on: :collection
+    get 'signatures', on: :collection
+  end
   get '/user_agreements/signatures' => 'user_agreements#signatures'
   resources :nodes
   resources :humans
@@ -19,6 +21,7 @@ ArvadosWorkbench::Application.routes.draw do
   resources :users do
     get 'home', :on => :member
     get 'welcome', :on => :collection
+    get 'activity', :on => :collection
     post 'sudo', :on => :member
   end
   resources :logs
index c9f12fc1a929d775104dedcce23d8e63f383dc45..ec1ae7bdc478a08cc172eca7c30ffd7eecda1cba 100644 (file)
@@ -2,7 +2,18 @@ namespace :config do
   desc 'Ensure site configuration has all required settings'
   task check: :environment do
     $application_config.sort.each do |k, v|
-      $stderr.puts "%-32s %s" % [k, eval("Rails.configuration.#{k}")]
+      if ENV.has_key?('QUIET') then
+        # Make sure we still check for the variable to exist
+        eval("Rails.configuration.#{k}")
+      else
+        if /(password|secret)/.match(k) then
+          # Make sure we still check for the variable to exist, but don't print the value
+          eval("Rails.configuration.#{k}")
+          $stderr.puts "%-32s %s" % [k, '*********']
+        else
+          $stderr.puts "%-32s %s" % [k, eval("Rails.configuration.#{k}")]
+        end
+      end
     end
   end
 end
diff --git a/apps/workbench/test/integration/logins_test.rb b/apps/workbench/test/integration/logins_test.rb
new file mode 100644 (file)
index 0000000..84170dd
--- /dev/null
@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class LoginsTest < ActionDispatch::IntegrationTest
+  test "login with api_token works after redirect" do
+    visit page_with_token('active_trustedclient')
+    assert page.has_text? 'Recent jobs'
+    assert_no_match(/\bapi_token=/, current_path)
+  end
+
+  test "can't use expired token" do
+    visit page_with_token('expired_trustedclient')
+    assert page.has_text? 'Log in'
+  end
+end
diff --git a/apps/workbench/test/integration/smoke_test.rb b/apps/workbench/test/integration/smoke_test.rb
new file mode 100644 (file)
index 0000000..700c8e6
--- /dev/null
@@ -0,0 +1,39 @@
+require 'integration_helper'
+require 'uri'
+
+class SmokeTest < ActionDispatch::IntegrationTest
+  def assert_visit_success(allowed=[200])
+    assert_includes(allowed, status_code,
+                    "#{current_url} returned #{status_code}, not one of " +
+                    allowed.inspect)
+  end
+
+  def all_links_in(find_spec, text_regexp=//)
+    find(find_spec).all('a').collect { |tag|
+      if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
+        nil
+      else
+        url = URI(tag[:href])
+        url.host.nil? ? url.path : nil
+      end
+    }.compact
+  end
+
+  test "all first-level links succeed" do
+    visit page_with_token('active_trustedclient', '/')
+    assert_visit_success
+    click_link 'user-menu'
+    urls = [all_links_in('.arvados-nav'),
+            all_links_in('.navbar', /^Manage /)].flatten
+    seen_urls = ['/']
+    while not (url = urls.shift).nil?
+      next if seen_urls.include? url
+      visit url
+      seen_urls << url
+      assert_visit_success
+      # Uncommenting the line below lets you crawl the entire site for a
+      # more thorough test.
+      # urls += all_links_in('body')
+    end
+  end
+end
diff --git a/apps/workbench/test/integration/virtual_machines_test.rb b/apps/workbench/test/integration/virtual_machines_test.rb
new file mode 100644 (file)
index 0000000..541a7aa
--- /dev/null
@@ -0,0 +1,17 @@
+require 'integration_helper'
+
+class VirtualMachinesTest < ActionDispatch::IntegrationTest
+  test "make and name a new virtual machine" do
+    Capybara.current_driver = Capybara.javascript_driver
+    visit page_with_token('admin_trustedclient')
+    click_link 'Virtual machines'
+    assert page.has_text? 'testvm.shell'
+    click_on 'Add a new virtual machine'
+    assert page.has_text? 'none'
+    click_link 'none'
+    assert page.has_text? 'Update hostname'
+    fill_in 'editable-text', with: 'testname'
+    click_button 'editable-submit'
+    assert page.has_text? 'testname'
+  end
+end
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
new file mode 100644 (file)
index 0000000..8616283
--- /dev/null
@@ -0,0 +1,77 @@
+require 'test_helper'
+require 'capybara/rails'
+require 'capybara/poltergeist'
+require 'uri'
+require 'yaml'
+
+$ARV_API_SERVER_DIR = File.expand_path('../../../../services/api', __FILE__)
+SERVER_PID_PATH = 'tmp/pids/server.pid'
+
+class ActionDispatch::IntegrationTest
+  # Make the Capybara DSL available in all integration tests
+  include Capybara::DSL
+
+  def self.api_fixture(name)
+    # Returns the data structure from the named API server test fixture.
+    path = File.join($ARV_API_SERVER_DIR, 'test', 'fixtures', "#{name}.yml")
+    YAML.load(IO.read(path))
+  end
+
+  @@API_AUTHS = api_fixture('api_client_authorizations')
+
+  def page_with_token(token, path='/')
+    # Generate a page path with an embedded API token.
+    # Typical usage: visit page_with_token('token_name', page)
+    # The token can be specified by the name of an api_client_authorizations
+    # fixture, or passed as a raw string.
+    api_token = ((@@API_AUTHS.include? token) ?
+                 @@API_AUTHS[token]['api_token'] : token)
+    sep = (path.include? '?') ? '&' : '?'
+    q_string = URI.encode_www_form('api_token' => api_token)
+    "#{path}#{sep}#{q_string}"
+  end
+end
+
+class IntegrationTestRunner < MiniTest::Unit
+  # Make a hash that unsets Bundle's environment variables.
+  # We'll use this environment when we launch Bundle commands in the API
+  # server.  Otherwise, those commands will try to use Workbench's gems, etc.
+  @@APIENV = ENV.map { |(key, val)| (key =~ /^BUNDLE_/) ? [key, nil] : nil }.
+    compact.to_h
+
+  def _system(*cmd)
+    if not system(@@APIENV, *cmd)
+      raise RuntimeError, "#{cmd[0]} returned exit code #{$?.exitstatus}"
+    end
+  end
+
+  def _run(args=[])
+    Capybara.javascript_driver = :poltergeist
+    server_pid = Dir.chdir($ARV_API_SERVER_DIR) do |apidir|
+      _system('bundle', 'exec', 'rake', 'db:test:load')
+      _system('bundle', 'exec', 'rake', 'db:fixtures:load')
+      _system('bundle', 'exec', 'rails', 'server', '-d')
+      timeout = Time.now.tv_sec + 10
+      begin
+        sleep 0.2
+        begin
+          server_pid = IO.read(SERVER_PID_PATH).to_i
+          good_pid = (server_pid > 0) and (Process.kill(0, pid) rescue false)
+        rescue Errno::ENOENT
+          good_pid = false
+        end
+      end while (not good_pid) and (Time.now.tv_sec < timeout)
+      if not good_pid
+        raise RuntimeError, "could not find API server Rails pid"
+      end
+      server_pid
+    end
+    begin
+      super(args)
+    ensure
+      Process.kill('TERM', server_pid)
+    end
+  end
+end
+
+MiniTest::Unit.runner = IntegrationTestRunner.new
diff --git a/by-sa-3.0.txt b/by-sa-3.0.txt
new file mode 100644 (file)
index 0000000..281c9b6
--- /dev/null
@@ -0,0 +1,297 @@
+Creative Commons Legal Code
+
+Attribution-ShareAlike 3.0 United States
+
+License
+
+THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
+COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
+COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
+AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
+
+BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE
+BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE
+CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE
+IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
+
+1. Definitions
+
+ a. "Collective Work" means a work, such as a periodical issue, anthology or
+    encyclopedia, in which the Work in its entirety in unmodified form, along
+    with one or more other contributions, constituting separate and independent
+    works in themselves, are assembled into a collective whole. A work that
+    constitutes a Collective Work will not be considered a Derivative Work (as
+    defined below) for the purposes of this License.
+
+ b. "Creative Commons Compatible License" means a license that is listed at
+    http://creativecommons.org/compatiblelicenses that has been approved by
+    Creative Commons as being essentially equivalent to this License,
+    including, at a minimum, because that license: (i) contains terms that have
+    the same purpose, meaning and effect as the License Elements of this
+    License; and, (ii) explicitly permits the relicensing of derivatives of
+    works made available under that license under this License or either a
+    Creative Commons unported license or a Creative Commons jurisdiction
+    license with the same License Elements as this License.
+
+ c. "Derivative Work" means a work based upon the Work or upon the Work and
+    other pre-existing works, such as a translation, musical arrangement,
+    dramatization, fictionalization, motion picture version, sound recording,
+    art reproduction, abridgment, condensation, or any other form in which the
+    Work may be recast, transformed, or adapted, except that a work that
+    constitutes a Collective Work will not be considered a Derivative Work for
+    the purpose of this License. For the avoidance of doubt, where the Work is
+    a musical composition or sound recording, the synchronization of the Work
+    in timed-relation with a moving image ("synching") will be considered a
+    Derivative Work for the purpose of this License.
+
+ d. "License Elements" means the following high-level license attributes as
+    selected by Licensor and indicated in the title of this License:
+    Attribution, ShareAlike.
+
+ e. "Licensor" means the individual, individuals, entity or entities that
+    offers the Work under the terms of this License.
+
+ f. "Original Author" means the individual, individuals, entity or entities who
+    created the Work.
+
+ g. "Work" means the copyrightable work of authorship offered under the terms
+    of this License.
+
+    h. "You" means an individual or entity exercising rights under this License
+    who has not previously violated the terms of this License with respect to
+    the Work, or who has received express permission from the Licensor to
+    exercise rights under this License despite a previous violation.
+
+2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or
+restrict any rights arising from fair use, first sale or other limitations on
+the exclusive rights of the copyright owner under copyright law or other
+applicable laws.
+
+3. License Grant. Subject to the terms and conditions of this License, Licensor
+hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the
+duration of the applicable copyright) license to exercise the rights in the
+Work as stated below:
+
+ a. to reproduce the Work, to incorporate the Work into one or more Collective
+    Works, and to reproduce the Work as incorporated in the Collective Works;
+
+ b. to create and reproduce Derivative Works provided that any such
+    Derivative Work, including any translation in any medium, takes reasonable
+    steps to clearly label, demarcate or otherwise identify that changes were
+    made to the original Work. For example, a translation could be marked "The
+    original work was translated from English to Spanish," or a modification
+    could indicate "The original work has been modified.";
+
+ c. to distribute copies or phonorecords of, display publicly, perform
+    publicly, and perform publicly by means of a digital audio transmission the
+    Work including as incorporated in Collective Works;
+
+ d. to distribute copies or phonorecords of, display publicly, perform
+    publicly, and perform publicly by means of a digital audio transmission
+    Derivative Works.
+
+ e. For the avoidance of doubt, where the Work is a musical composition:
+
+     i. Performance Royalties Under Blanket Licenses. Licensor waives the
+        exclusive right to collect, whether individually or, in the event that
+        Licensor is a member of a performance rights society (e.g. ASCAP, BMI,
+        SESAC), via that society, royalties for the public performance or
+        public digital performance (e.g. webcast) of the Work.
+
+    ii. Mechanical Rights and Statutory Royalties. Licensor waives the
+        exclusive right to collect, whether individually or via a music rights
+        agency or designated agent (e.g. Harry Fox Agency), royalties for any
+        phonorecord You create from the Work ("cover version") and distribute,
+        subject to the compulsory license created by 17 USC Section 115 of the
+        US Copyright Act (or the equivalent in other jurisdictions).
+
+ f. Webcasting Rights and Statutory Royalties. For the avoidance of doubt,
+    where the Work is a sound recording, Licensor waives the exclusive right to
+    collect, whether individually or via a performance-rights society
+    (e.g. SoundExchange), royalties for the public digital performance
+    (e.g. webcast) of the Work, subject to the compulsory license created by 17
+    USC Section 114 of the US Copyright Act (or the equivalent in other
+    jurisdictions).
+
+The above rights may be exercised in all media and formats whether now known or
+hereafter devised. The above rights include the right to make such
+modifications as are technically necessary to exercise the rights in other
+media and formats. All rights not expressly granted by Licensor are hereby
+reserved.
+
+4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
+
+ a. You may distribute, publicly display, publicly perform, or publicly
+    digitally perform the Work only under the terms of this License, and You
+    must include a copy of, or the Uniform Resource Identifier for, this
+    License with every copy or phonorecord of the Work You distribute, publicly
+    display, publicly perform, or publicly digitally perform. You may not offer
+    or impose any terms on the Work that restrict the terms of this License or
+    the ability of a recipient of the Work to exercise of the rights granted to
+    that recipient under the terms of the License. You may not sublicense the
+    Work. You must keep intact all notices that refer to this License and to
+    the disclaimer of warranties. When You distribute, publicly display,
+    publicly perform, or publicly digitally perform the Work, You may not
+    impose any technological measures on the Work that restrict the ability of
+    a recipient of the Work from You to exercise of the rights granted to that
+    recipient under the terms of the License. This Section 4(a) applies to the
+    Work as incorporated in a Collective Work, but this does not require the
+    Collective Work apart from the Work itself to be made subject to the terms
+    of this License. If You create a Collective Work, upon notice from any
+    Licensor You must, to the extent practicable, remove from the Collective
+    Work any credit as required by Section 4(c), as requested. If You create a
+    Derivative Work, upon notice from any Licensor You must, to the extent
+    practicable, remove from the Derivative Work any credit as required by
+    Section 4(c), as requested.
+
+ b. You may distribute, publicly display, publicly perform, or publicly
+    digitally perform a Derivative Work only under: (i) the terms of this
+    License; (ii) a later version of this License with the same License
+    Elements as this License; (iii) either the Creative Commons (Unported)
+    license or a Creative Commons jurisdiction license (either this or a later
+    license version) that contains the same License Elements as this License
+    (e.g. Attribution-ShareAlike 3.0 (Unported)); (iv) a Creative Commons
+    Compatible License. If you license the Derivative Work under one of the
+    licenses mentioned in (iv), you must comply with the terms of that
+    license. If you license the Derivative Work under the terms of any of the
+    licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you
+    must comply with the terms of the Applicable License generally and with the
+    following provisions: (I) You must include a copy of, or the Uniform
+    Resource Identifier for, the Applicable License with every copy or
+    phonorecord of each Derivative Work You distribute, publicly display,
+    publicly perform, or publicly digitally perform; (II) You may not offer or
+    impose any terms on the Derivative Works that restrict the terms of the
+    Applicable License or the ability of a recipient of the Work to exercise
+    the rights granted to that recipient under the terms of the Applicable
+    License; (III) You must keep intact all notices that refer to the
+    Applicable License and to the disclaimer of warranties; and, (IV) when You
+    distribute, publicly display, publicly perform, or publicly digitally
+    perform the Work, You may not impose any technological measures on the
+    Derivative Work that restrict the ability of a recipient of the Derivative
+    Work from You to exercise the rights granted to that recipient under the
+    terms of the Applicable License. This Section 4(b) applies to the
+    Derivative Work as incorporated in a Collective Work, but this does not
+    require the Collective Work apart from the Derivative Work itself to be
+    made subject to the terms of the Applicable License.
+
+ c. If You distribute, publicly display, publicly perform, or publicly
+    digitally perform the Work (as defined in Section 1 above) or any
+    Derivative Works (as defined in Section 1 above) or Collective Works (as
+    defined in Section 1 above), You must, unless a request has been made
+    pursuant to Section 4(a), keep intact all copyright notices for the Work
+    and provide, reasonable to the medium or means You are utilizing: (i) the
+    name of the Original Author (or pseudonym, if applicable) if supplied,
+    and/or (ii) if the Original Author and/or Licensor designate another party
+    or parties (e.g. a sponsor institute, publishing entity, journal) for
+    attribution ("Attribution Parties") in Licensor's copyright notice, terms
+    of service or by other reasonable means, the name of such party or parties;
+    the title of the Work if supplied; to the extent reasonably practicable,
+    the Uniform Resource Identifier, if any, that Licensor specifies to be
+    associated with the Work, unless such URI does not refer to the copyright
+    notice or licensing information for the Work; and, consistent with Section
+    3(b) in the case of a Derivative Work, a credit identifying the use of the
+    Work in the Derivative Work (e.g., "French translation of the Work by
+    Original Author," or "Screenplay based on original Work by Original
+    Author"). The credit required by this Section 4(c) may be implemented in
+    any reasonable manner; provided, however, that in the case of a Derivative
+    Work or Collective Work, at a minimum such credit will appear, if a credit
+    for all contributing authors of the Derivative Work or Collective Work
+    appears, then as part of these credits and in a manner at least as
+    prominent as the credits for the other contributing authors. For the
+    avoidance of doubt, You may only use the credit required by this Section
+    for the purpose of attribution in the manner set out above and, by
+    exercising Your rights under this License, You may not implicitly or
+    explicitly assert or imply any connection with, sponsorship or endorsement
+    by the Original Author, Licensor and/or Attribution Parties, as
+    appropriate, of You or Your use of the Work, without the separate, express
+    prior written permission of the Original Author, Licensor and/or
+    Attribution Parties.
+
+
+5. Representations, Warranties and Disclaimer
+
+UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS
+THE WORK AS-IS AND ONLY TO THE EXTENT OF ANY RIGHTS HELD IN THE LICENSED WORK
+BY THE LICENSOR. THE LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
+KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING,
+WITHOUT LIMITATION, WARRANTIES OF TITLE, MARKETABILITY, MERCHANTIBILITY,
+FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR
+OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT
+DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
+WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
+
+6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN
+NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
+INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS
+LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. Termination
+
+ a. This License and the rights granted hereunder will terminate automatically
+    upon any breach by You of the terms of this License. Individuals or
+    entities who have received Derivative Works or Collective Works from You
+    under this License, however, will not have their licenses terminated
+    provided such individuals or entities remain in full compliance with those
+    licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of
+    this License.
+
+ b. Subject to the above terms and conditions, the license granted here is
+    perpetual (for the duration of the applicable copyright in the
+    Work). Notwithstanding the above, Licensor reserves the right to release
+    the Work under different license terms or to stop distributing the Work at
+    any time; provided, however that any such election will not serve to
+    withdraw this License (or any other license that has been, or is required
+    to be, granted under the terms of this License), and this License will
+    continue in full force and effect unless terminated as stated above.
+
+8. Miscellaneous
+
+ a. Each time You distribute or publicly digitally perform the Work (as defined
+    in Section 1 above) or a Collective Work (as defined in Section 1 above),
+    the Licensor offers to the recipient a license to the Work on the same
+    terms and conditions as the license granted to You under this License.
+
+ b. Each time You distribute or publicly digitally perform a Derivative Work,
+    Licensor offers to the recipient a license to the original Work on the same
+    terms and conditions as the license granted to You under this License.
+
+ c. If any provision of this License is invalid or unenforceable under
+    applicable law, it shall not affect the validity or enforceability of the
+    remainder of the terms of this License, and without further action by the
+    parties to this agreement, such provision shall be reformed to the minimum
+    extent necessary to make such provision valid and enforceable.
+
+ d. No term or provision of this License shall be deemed waived and no breach
+    consented to unless such waiver or consent shall be in writing and signed
+    by the party to be charged with such waiver or consent.
+
+ e. This License constitutes the entire agreement between the parties with
+    respect to the Work licensed here. There are no understandings, agreements
+    or representations with respect to the Work not specified here. Licensor
+    shall not be bound by any additional provisions that may appear in any
+    communication from You. This License may not be modified without the mutual
+    written agreement of the Licensor and You.
+
+Creative Commons Notice
+
+    Creative Commons is not a party to this License, and makes no warranty
+    whatsoever in connection with the Work. Creative Commons will not be liable
+    to You or any party on any legal theory for any damages whatsoever,
+    including without limitation any general, special, incidental or
+    consequential damages arising in connection to this
+    license. Notwithstanding the foregoing two (2) sentences, if Creative
+    Commons has expressly identified itself as the Licensor hereunder, it shall
+    have all rights and obligations of Licensor.
+
+    Except for the limited purpose of indicating to the public that the Work is
+    licensed under the CCPL, Creative Commons does not authorize the use by
+    either party of the trademark "Creative Commons" or any related trademark
+    or logo of Creative Commons without the prior written consent of Creative
+    Commons. Any permitted use will be in compliance with Creative Commons'
+    then-current trademark usage guidelines, as may be published on its website
+    or otherwise made available upon request from time to time. For the
+    avoidance of doubt, this trademark restriction does not form part of this
+    License.
+
+    Creative Commons may be contacted at http://creativecommons.org/.
index 381b70676339e997229b26840db2efe3773203dd..9ee5f581c39ca8a88d4839dd9a8e86115e31b6d2 100644 (file)
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
 gem 'zenweb'
 gem 'liquid'
 gem 'RedCloth'
-gem 'colorize'
\ No newline at end of file
+gem 'colorize'
diff --git a/doc/README.textile b/doc/README.textile
new file mode 100644 (file)
index 0000000..23a82fe
--- /dev/null
@@ -0,0 +1,52 @@
+h1. Arvados documentation
+
+This is the source code for "doc.arvados.org":http://doc.arvados.org.
+
+Here's how to build the HTML pages locally so you can preview your updates before you commit and push.
+
+Additional information is available on the "'Documentation' page on the Arvados wiki":https://arvados.org/projects/arvados/wiki/Documentation.
+
+h2. 0. Install dependencies
+
+<pre>
+arvados/doc$ bundle install
+</pre>
+
+h2. 1. Generate HTML pages
+
+<pre>
+arvados/doc$ rake
+</pre>
+
+h2. 2. Preview HTML pages
+
+<pre>
+arvados/doc$ rake run
+[2014-03-10 09:03:41] INFO  WEBrick 1.3.1
+[2014-03-10 09:03:41] INFO  ruby 2.1.1 (2014-02-24) [x86_64-linux]
+[2014-03-10 09:03:41] INFO  WEBrick::HTTPServer#start: pid=8926 port=8000
+</pre>
+
+Preview the rendered pages at "http://localhost:8000":http://localhost:8000.
+
+h2. 3. Publish HTML pages inside Workbench
+
+(or some other web site)
+
+You can set @baseurl@ (the URL prefix for all internal links), @arvados_api_host@ and @arvados_workbench_host@ without changing @_config.yml@:
+
+<pre>
+arvados/doc$ rake generate baseurl=/doc arvados_api_host=xyzzy.arvadosapi.com
+</pre>
+
+Make the docs appear at {workbench_host}/doc by creating a symbolic link in Workbench's @public@ directory, pointing to the generated HTML tree.
+
+<pre>
+arvados/doc$ ln -sn ../../../doc/.site ../apps/workbench/public/doc
+</pre>
+
+h2. 4. Delete generated files
+
+<pre>
+arvados/doc$ rake realclean
+</pre>
index a10d54cdee319411f83419fac5e731cb3eb26aec..d8af62f5e33b0bbae7a619044c3ce08739e01b0c 100644 (file)
@@ -3,6 +3,15 @@
 require "rubygems"
 require "colorize"
 
+task :generate do
+  vars = ['baseurl', 'arvados_api_host', 'arvados_workbench_host']
+  vars.each do |v|
+    if ENV[v]
+      website.config.h[v] = ENV[v]
+    end
+  end
+end
+
 require "zenweb/tasks"
 load "zenweb-textile.rb"
 load "zenweb-liquid.rb"
index 4707d8e930e7e1cc17e0f785ae8980ae71f79d62..c75b0a4f5e0554c940d10db4ac5e54006c90b600 100644 (file)
@@ -3,11 +3,14 @@
 # file:///tmp/arvados/doc/.site). To make docs show up inside
 # workbench, use /doc here and add a symlink at
 # apps/workbench/public/doc pointing to ../../../doc/.site
+# You can also set these on the command line:
+# $ rake generate baseurl=/example arvados_api_host=example.comA
 
-baseurl: /doc
+baseurl: 
+arvados_api_host: localhost
+arvados_workbench_host: localhost
 
 exclude: ["Rakefile", "tmp", "vendor"]
-arvados_api_host: qr1hi.arvadosapi.com
 
 navbar:
   userguide:
@@ -19,19 +22,29 @@ navbar:
       - user/getting_started/community.html.textile.liquid
     - Tutorials:
       - user/tutorials/tutorial-keep.html.textile.liquid
-      - user/tutorials/tutorial-job1.html.textile.liquid
+      - user/tutorials/intro-crunch.html.textile.liquid
+      - user/tutorials/tutorial-pipeline-workbench.html.textile.liquid
       - user/tutorials/tutorial-firstscript.html.textile.liquid
-      - user/tutorials/tutorial-job-debug.html.textile.liquid
-      - user/tutorials/tutorial-parallel.html.textile.liquid
       - user/tutorials/tutorial-new-pipeline.html.textile.liquid
-      - user/tutorials/tutorial-trait-search.html.textile.liquid
-      - user/tutorials/tutorial-gatk-variantfiltration.html.textile.liquid
       - user/tutorials/running-external-program.html.textile.liquid
+    - Intermediate topics:
+      - user/topics/running-pipeline-command-line.html.textile.liquid
+      - user/topics/tutorial-job1.html.textile.liquid
+      - user/topics/tutorial-job-debug.html.textile.liquid
+      - user/topics/tutorial-parallel.html.textile.liquid
+      - user/topics/tutorial-trait-search.html.textile.liquid
+      - user/topics/tutorial-gatk-variantfiltration.html.textile.liquid
+      - user/topics/keep.html.textile.liquid
     - Examples:
       - user/examples/crunch-examples.html.textile.liquid
     - Reference:
       - user/reference/api-tokens.html.textile.liquid
       - user/reference/sdk-cli.html.textile.liquid
+    - Arvados License:
+      - user/copying/copying.html.textile.liquid
+      - user/copying/agpl-3.0.html
+      - user/copying/LICENSE-2.0.html
+      - user/copying/by-sa-3.0.html
   sdk:
     - Overview:
       - sdk/index.html.textile.liquid
@@ -99,9 +112,10 @@ navbar:
       - admin/cheat_sheet.html.textile.liquid
   installguide:
     - Install:
-      - install/install-api-server.html.md.liquid
       - install/index.html.md.liquid
-      - install/install-workbench-app.html.md.liquid
+      - install/install-sso.html.textile.liquid
+      - install/install-api-server.html.textile.liquid
+      - install/install-workbench-app.html.textile.liquid
       - install/client.html.textile.liquid
       - install/create-standard-objects.html.textile.liquid
       - install/install-crunch-dispatch.html.textile.liquid
index a770c8667a7254149fc04cff1d25c3d91b091407..16516a8852556fa374f8b7c05bc5b9cb6dff80c0 100644 (file)
@@ -2,34 +2,17 @@
 
 import arvados
 
-arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True)
-this_task = arvados.current_task()
+# Automatically parallelize this job by running one task per file.
+arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=True)
 
-# Get the input collection for this task
-this_task_input = this_task['parameters']['input']
+# Get the input file for the task
+input_file = arvados.get_task_param_mount('input')
 
-# Create a CollectionReader to access the collection
-input_collection = arvados.CollectionReader(this_task_input)
+# Run the external 'md5sum' program on the input file
+stdoutdata, stderrdata = arvados.util.run_command(['md5sum', input_file])
 
-# Get the name of the first file in the collection
-input_file = list(input_collection.all_files())[0].name()
-
-# Extract the file to a temporary directory
-# Returns the directory that the file was written to
-input_dir = arvados.util.collection_extract(this_task_input,
-        'tmp',
-        files=[input_file],
-        decompress=False)
-
-# Run the external 'md5sum' program on the input file, with the current working
-# directory set to the location the input file was extracted to.
-stdoutdata, stderrdata = arvados.util.run_command(
-        ['md5sum', input_file],
-        cwd=input_dir)
-
-# Save the standard output (stdoutdata) "md5sum.txt" in the output collection
+# Save the standard output (stdoutdata) to "md5sum.txt" in the output collection
 out = arvados.CollectionWriter()
 out.set_current_file_name("md5sum.txt")
 out.write(stdoutdata)
-
-this_task.set_output(out.finish())
+arvados.current_task().set_output(out.finish())
index f9b2ec094860f552065098ddfe8b148193536650..0dcabaefc14a0d38f4883708243823ef5a543826 100644 (file)
@@ -1,63 +1,45 @@
 #!/usr/bin/env python
 
-# Import the hashlib module (part of the Python standard library) to compute md5.
-import hashlib
+import hashlib      # Import the hashlib module to compute md5.
+import arvados      # Import the Arvados sdk module
 
-# Import the Arvados sdk module
-import arvados
+# Automatically parallelize this job by running one task per file.
+# This means that if the input consists of many files, each file will
+# be processed in parallel on different nodes enabling the job to 
+# be completed quicker.
+arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, 
+                                          input_as_path=True)
 
-# Get information about the task from the environment
-this_task = arvados.current_task()
-
-# Get the "input" field from "script_parameters" on the job creation object
-this_job_input = arvados.getjobparam('input')
-
-# Create the object access to the collection referred to in the input
-collection = arvados.CollectionReader(this_job_input)
-
-# Create an object to write a new collection as output
-out = arvados.CollectionWriter()
-
-# Set the name of output file within the collection
-out.set_current_file_name("md5sum.txt")
+# Create the message digest object that will compute the md5 hash
+digestor = hashlib.new('md5')
 
-# Get an iterator over the files listed in the collection
-all_files = collection.all_files()
-
-# Iterate over each file
-for input_file in all_files:
-    # Create the object that will actually compute the md5 hash
-    digestor = hashlib.new('md5')
+# Get the input file for the task
+input_file = arvados.get_task_param_mount('input')
 
+# Open the input file for reading
+with open(input_file) as f:
     while True:
-        # read a 1 megabyte block from the file
-        buf = input_file.read(2**20)
-
-        # break when there is no more data left
-        if len(buf) == 0:
+        buf = f.read(2**20)      # read a 1 megabyte block from the file
+        if len(buf) == 0:        # break when there is no more data left
             break
+        digestor.update(buf)     # update the md5 hash object
 
-        # update the md5 hash object
-        digestor.update(buf)
-
-    # Get the final hash code
-    hexdigest = digestor.hexdigest()
+# Get object representing the current task
+this_task = arvados.current_task()
 
   # Get the file name from the StreamFileReader object
-    file_name = input_file.name()
# Write a new collection as output
+out = arvados.CollectionWriter()
 
-    # The "stream name" is the subdirectory inside the collection in which
-    # the file is located; '.' is the root of the collection.
-    if input_file.stream_name() != '.':
-        file_name = os.join(input_file.stream_name(), file_name)
+ # Set output file within the collection
+out.set_current_file_name("md5sum.txt")
 
-    # Write an output line with the md5 value and file name.
-    out.write("%s %s\n" % (hexdigest, file_name))
+# Write an output line with the md5 value and input
+out.write("%s %s\n" % (digestor.hexdigest(), this_task['parameters']['input']))
 
-# Commit the output to keep.  This returns a Keep id.
+ # Commit the output to keep.  This returns a Keep id.
 output_id = out.finish()
 
 # Set the output for this task to the Keep id
-this_task.set_output(output_id)
+this_task.set_output(output_id) 
 
 # Done!
diff --git a/doc/_includes/_webring.liquid b/doc/_includes/_webring.liquid
new file mode 100644 (file)
index 0000000..edcfedf
--- /dev/null
@@ -0,0 +1,29 @@
+{% assign n = 0 %}
+{% assign prev = "" %}
+{% assign nx = 0 %}
+{% for section in site.navbar[page.navsection] %}
+  {% for entry in section %}
+    {% for item in entry[1] %}        
+      {% assign p = site.pages[item] %}
+      {% if nx == 1 %}
+        <hr>
+        {% if prev != "" %}
+          <a href="{{ site.baseurl }}{{ prev.url }}" class="pull-left">Previous: {{ prev.title }}</a></li>
+        {% endif %}
+        <a href="{{ site.baseurl }}{{ p.url }}" class="pull-right">Next: {{ p.title }}</a></li>            
+        {% assign nx = 0 %}
+        {% assign n = 1 %}
+      {% endif %}
+      {% if p.url == page.url %}
+        {% assign nx = 1 %}
+      {% else %}
+        {% assign prev = p %}
+      {% endif %}
+    {% endfor %}
+  {% endfor %}
+{% endfor %}
+{% if n == 0 && prev != "" %}
+  <hr>
+  <a href="{{ site.baseurl }}{{ prev.url }}" class="pull-left">Previous: {{ prev.title }}</a></li>  
+  {% assign n = 1 %}
+{% endif %}
\ No newline at end of file
index 732b2addda86672ca8f5a35daaeebc1949212261..4585b7032abc7d91e8869ff4319b061ba9ad0d09 100644 (file)
@@ -11,6 +11,7 @@
     <link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
     <link href="{{ site.baseurl }}/css/nav-list.css" rel="stylesheet">
     <link href="{{ site.baseurl }}/css/badges.css" rel="stylesheet">
+    <link href="{{ site.baseurl }}/css/code.css" rel="stylesheet">
     <style>
       html {
       height:100%;
       text-align: center;
       margin-bottom: 1em;
       }
-      .userinput {
-      color: #d14;
-      }
       :target {
       padding-top: 61px;
       margin-top: -61px;
       }
     </style>
-    <link href="{{ site.baseurl }}/css/bootstrap-responsive.min.css" rel="stylesheet">
+    
     <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
     <!--[if lt IE 9]>
         <script src="../assets/js/html5shiv.js"></script>
@@ -77,7 +75,9 @@
       <div class="row">
         {% include 'navbar_left' %}
         <div class="col-sm-9">
+          <h1>{{ page.title }}</h1>
           {{ content }}
+          {% include 'webring' %}
         </div>
       </div>
 
 
     </script>
 
-<p style="text-align: center">
-The content of this documentation is licensed under a
-<a href="https://creativecommons.org/licenses/by-sa/3.0/us/">Creative
-  Commons Attribution-Share Alike 3.0 United States</a> licence.
+<p style="text-align: center"><small>
+The content of this documentation is licensed under the
+<a href="{{ site.baseurl }}/user/copying/by-sa-3.0.html">Creative
+  Commons Attribution-Share Alike 3.0 United States</a> licence.<br>
+Code samples in this documentation are licensed under the 
+<a href="{{ site.baseurl }}/user/copying/LICENSE-2.0.html">Apache License, Version 2.0.</a></small>
 </p>
 
   </body>
index f811755260d6bcd9c1bea1e2965c67aa92a1f076..daaf012bd19a75c579f6333b359f5176c89e9b89 100644 (file)
@@ -4,7 +4,7 @@ navsection: admin
 title: Cheat Sheet
 ...
 
-h1. Cheat Sheet
+
 
 h3. CLI setup
 
index 1b5e240de6f71cbf1657db1046f66b50a936950a..cbf75532ffd2d1d995b11cef470a734c61b4e63a 100644 (file)
@@ -6,7 +6,7 @@ title: Authentication
 
 ...
 
-h1. Authentication
+
 
 Every API request (except the authentication API itself) includes an @access_token@ parameter.
 
index 097216d3a0e5df1d049b1129337b49b68da0eed9..4b0df898f355b48f21be9d4a7b24a4392db549ec 100644 (file)
@@ -5,7 +5,7 @@ title: API Reference
 
 ...
 
-h1. API Reference
+
 
 h2. Concepts
 
index 2bfb9c4bfb1e2f7b026fc642c2b69bfe011962c2..0110ebbcd7b5fae925d9666a83d121afe67805b7 100644 (file)
@@ -6,7 +6,7 @@ title: REST methods
 
 ...
 
-h1. REST Methods
+
 
 (using Group as an example)
 
index 74fd21e47d241fd8892cc55f13d0fbc850663c69..75ffd3ffbed0e191915749855b34fd4964a13466 100644 (file)
@@ -6,7 +6,7 @@ title: "api_client_authorizations"
 
 ...
 
-h1. api_client_authorizations
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 37eaa0a64aad2ce52568f07f82db4386f350471b..c6b784482c6c97aa3964f7ec183e3270a794f55e 100644 (file)
@@ -6,7 +6,7 @@ title: "api_clients"
 
 ...
 
-h1. api_clients
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 0c5b7eea5bfcc5c706a7a1ba118bb7881434d7f6..a3cc9e5afa7b0bcc52ef2b3b772198f31a896334 100644 (file)
@@ -6,7 +6,7 @@ title: "authorized_keys"
 
 ...
 
-h1. authorized_keys
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 9c631c214057c4ae1a102051c27700422bd44d1f..6f9d142a47125bae2f5413b4bb166cbe1fa88707 100644 (file)
@@ -6,7 +6,7 @@ title: "collections"
 
 ...
 
-h1. collections
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index f897eab2b8127e73f6cc368b1e318d34d8b50fa8..e09b8177d5e75d6ab4a74d08fcd032ac077e97b0 100644 (file)
@@ -6,7 +6,7 @@ title: "groups"
 
 ...
 
-h1. groups
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index a0e715b58e8b7fb2027187bcab251c34267e7f02..dd3fcedb83e7c281c049ded8ae0511d9d5a547cc 100644 (file)
@@ -6,7 +6,7 @@ title: "humans"
 
 ...
 
-h1. humans
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index daf4aa28d69f51c7374c0c7e42807add8339bf60..ed3fcfab68e44a8bf527e93368d079e96443ccbb 100644 (file)
@@ -6,7 +6,7 @@ title: "job_tasks"
 
 ...
 
-h1. job_tasks
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index f3e51fcbd22d5906684ea6adf643de75094a97fb..a84d70abbfc97da020d86a2b92cc2b4b258660fa 100644 (file)
@@ -6,7 +6,7 @@ title: "jobs"
 
 ...
 
-h1. jobs
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 720130fa6fe61200c4f54a57f96c87640d54ee65..8fa04f544d508e5cbbacc3bab582dda58dd1f9f7 100644 (file)
@@ -6,7 +6,7 @@ title: "keep_disks"
 
 ...
 
-h1. keep_disks
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 0885f428e79c2697a596fabc251f520288749d20..0490bf9bd65f44c8712394f5481b94cb29708eba 100644 (file)
@@ -6,7 +6,7 @@ title: "links"
 
 ...
 
-h1. links
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index b7934e50db299b47c806bf14fb04bd1654ab89d8..2a19853755dfc436c34b0ca4870fc90b48904fd6 100644 (file)
@@ -6,7 +6,7 @@ title: "logs"
 
 ...
 
-h1. logs
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 081734dc0557810351cf02cd9bae37c5a8ea2af1..f02d50c660633f0e619697de78ca685450f5203c 100644 (file)
@@ -6,7 +6,7 @@ title: "nodes"
 
 ...
 
-h1. nodes
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 5e9cb30febd790e35273b4c07c18a666d32f585c..b8431f185e231f876b14849f570c67195b9f3da9 100644 (file)
@@ -6,7 +6,7 @@ title: "pipeline_instances"
 
 ...
 
-h1. pipeline_instances
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index d353c7c7b6f4332e78b7b95d3cb9bacd4eecdc33..e8ead2433b62136a4310086355b6aeb51d697e35 100644 (file)
@@ -6,7 +6,7 @@ title: "pipeline_templates"
 
 ...
 
-h1. pipeline_templates
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 90dc0f5ace996e468534ec44bde4cfdf7ecc54d8..501bce7bb67571d051ceca3c968488981dad1e96 100644 (file)
@@ -6,7 +6,7 @@ title: "repositories"
 
 ...
 
-h1. repositories
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index f56542dc6b8c9356c8ef80e1307aa7b2709801c6..2d7d3c3958b7151613ee344a6beafe3c7c1030b7 100644 (file)
@@ -6,7 +6,7 @@ title: "specimens"
 
 ...
 
-h1. specimens
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index b2548b95859c0824f363d8b281b0634ce0eccae4..9b7cb92fd3375765a8dac882cbe5b4ba46772707 100644 (file)
@@ -6,7 +6,7 @@ title: "traits"
 
 ...
 
-h1. traits
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 9fbbda54e6134e40f3010402c4cde88824048291..649b3685f06a2aac2c52fef2c00550c37d85e72c 100644 (file)
@@ -6,7 +6,7 @@ title: "users"
 
 ...
 
-h1. users
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index e815232dc5212ef86e1f4f2cc728789401a81165..790519be7949110872f9c17a072f84df949df455 100644 (file)
@@ -6,7 +6,7 @@ title: "virtual_machines"
 
 ...
 
-h1. virtual_machines
+
 
 Required arguments are displayed in %{background:#ccffcc}green%.
 
index 73c99c1691d3d16b688df209aec2d41103a69be1..5481a1cf9d800ac1b2b8f666cad27373ab5230c1 100644 (file)
@@ -6,7 +6,7 @@ title: "Permission model"
 
 ...
 
-h1. Permission model
+
 
 Each API transaction (read, write, create, etc.) is done on behalf of a person.
 
index 05517fcccc4b7d6a13f4e9e3aa4038b3c6a6bc9c..0f800a51b2ff42bba557b2205f47084ec46679fd 100644 (file)
@@ -6,7 +6,7 @@ title: Resources
 
 ...
 
-h1. Resources
+
 
 This page describes the common attributes of Arvados resources.
 
index 90f1eebc9e2a5459bb709a02452b0da671237652..402d9ab7d6ded136545730262e7866ded83cb496 100644 (file)
@@ -6,7 +6,7 @@ title: ApiClient
 
 ...
 
-h1. ApiClient
+
 
 An **ApiClient** represents a client program that has issued a request to the API server.
 
index f8c3ee545fa0d7d3802b3a7925d8dc8411754d2a..2c0945b20364e3a2f231d2dc8bb60408623a80a7 100644 (file)
@@ -6,7 +6,7 @@ title: ApiClientAuthorization
 
 ...
 
-h1. ApiClientAuthorization
+
 
 A **ApiClientAuthorization** represents the API authorization token that has been issued to each "ApiClient":ApiClient.html known to this Arvados instance.
 
index 3606a26c82762c9ddf44fefe7d69b744131c8a0e..cb3443db42d683e2cfb57e61022637604be233c6 100644 (file)
@@ -6,7 +6,7 @@ title: AuthorizedKey
 
 ...
 
-h1. AuthorizedKey
+
 
 A **AuthorizedKey** represents...
 
index 4704d6392a999d6d6f1521f48279b9b1f984c8a1..ff08d816db33c55fab5c5997269a5bc7a5a7fc1d 100644 (file)
@@ -6,7 +6,7 @@ title: Collection
 
 ...
 
-h1. Collection
+
 
 This resource concerns metadata, usage accounting, and integrity checks for data stored on the cloud.  Reading and writing the data _per se_ is achieved by the "Keep":/user/tutorials/tutorial-keep.html storage system.
 
index 5bb95e1907e09c1b75c018db11e89f4ecf06ae1c..0c33859b083a63affafb5b2bdba7e02dafe602a2 100644 (file)
@@ -6,7 +6,7 @@ title: Commit
 
 ...
 
-h1. Commit
+
 
 A **Commit** represents...
 
index 904eec7cf4f696d38e5149887712537f959811df..c1bc47264a90e6408135b8fd57e2a7022f1d4f21 100644 (file)
@@ -6,7 +6,7 @@ title: CommitAncestor
 
 ...
 
-h1. CommitAncestor
+
 
 A **CommitAncestor** represents...
 
index 7fe3f11c265895b270996d0d98ad0f533832f1f5..607e26b97d367d31d92135a1ad4c3a0c60e55b89 100644 (file)
@@ -6,7 +6,7 @@ title: Group
 
 ...
 
-h1. Group
+
 
 A **Group** represents...
 
index 82c6c30e0c9e85cde3bb065d8be3051024d544ae..5ddb6e41ab9397bb2b1f8ef7f3692dd3f8652eea 100644 (file)
@@ -6,7 +6,7 @@ title: Human
 
 ...
 
-h1. Human
+
 
 A **Human** represents...
 
index 3fe631f67b2d5008a18d67270303bc47302de918..77579ffdb5096fa3d44af710218b52c364cb8ea8 100644 (file)
@@ -6,7 +6,7 @@ title: Job
 
 ...
 
-h1. Job
+
 
 Applications submit compute jobs when:
 * Provenance is important, i.e., it is worth recording how the output was produced; or
index f6818f40c6dcd04c8f751932e5782bf903c5995c..4e7aee97cdaf3c792af16192ed77c32bcaad51cc 100644 (file)
@@ -6,7 +6,7 @@ title: JobTask
 
 ...
 
-h1. JobTask
+
 
 A Job Task is a well defined independently-computable portion of a "Job":Job.html.
 
index cfaedc5d10ae3f75d414d9ef21dc1d4e3e627337..abfb368b060eecb3cda994eaaea39a3f1ad635a1 100644 (file)
@@ -6,7 +6,7 @@ title: KeepDisk
 
 ...
 
-h1. KeepDisk
+
 
 A **KeepDisk** represents...
 
index abad3838bf43e8bee971b7e155fe314c646a0d53..1191f875b3a5441480809d2bf9f14698e3047a00 100644 (file)
@@ -6,7 +6,7 @@ title: Link
 
 ...
 
-h1. Link
+
 
 **Links** describe relationships between Arvados objects, and from objects to primitives.
 
index 0435b8c0bb040c9d5f504628099810e687059b94..c9530f490415f968fda19c43945332b112cce408 100644 (file)
@@ -6,7 +6,7 @@ title: Log
 
 ...
 
-h1. Log
+
 
 **Log** objects record events that occur in an Arvados cluster. Both user-written pipelines and the Arvados system itself may generate Log events.
 
index a05bd3a4ea511de85c33e5deeab86f08b7093878..a067fbe465c39537755279120b03370e87f39955 100644 (file)
@@ -6,7 +6,7 @@ title: Node
 
 ...
 
-h1. Node
+
 
 A **Node** represents...
 
index 779c226ef8bfc3ce80bb5f2daa62364f261733ac..ecb9520fdbb9971470e95a814e9cb4fe58142131 100644 (file)
@@ -6,7 +6,7 @@ title: PipelineInstance
 
 ...
 
-h1. PipelineInstance
+
 
 A **PipelineInstance** represents...
 
index 7fc4959184e2dabe517da6bc6803e26409dee72b..d100c06988ef059b29ef0ca0d3e71798e507d2ee 100644 (file)
@@ -6,7 +6,7 @@ title: PipelineTemplate
 
 ...
 
-h1. PipelineTemplate
+
 
 A **PipelineTemplate** represents...
 
index c76ab82ee9369a8d888e64a41ac9ff0ceea8bacf..8c751d71937d451f91d5ef3b634a8f3242055ae3 100644 (file)
@@ -6,7 +6,7 @@ title: Repository
 
 ...
 
-h1. Repository
+
 
 A **Repository** represents...
 
index ab19bc0e5ab2f598471d63af0041674fb2396396..f841f0ed483df15874de6a38982d463baa27598e 100644 (file)
@@ -6,7 +6,7 @@ title: Specimen
 
 ...
 
-h1. Specimen
+
 
 A **Specimen** represents...
 
index e7cb741948e210e23879f010429abeca8c06a19b..d35cebeb1c4f954d749415ba527320397ac99e30 100644 (file)
@@ -6,7 +6,7 @@ title: Trait
 
 ...
 
-h1. Trait
+
 
 A **Trait** represents...
 
index 76d49787e1dee4cef62366dcda57b18468da9102..a75cf7e2f02ebc0860b8de1317ede0ae1a2cdad0 100644 (file)
@@ -6,7 +6,7 @@ title: User
 
 ...
 
-h1. User
+
 
 A **User** represents...
 
index 1e1de5fd452a84024008767d63ab0701e5d3d8b3..f6dd561082b86176cabe441ac0fd6cfd5f9de1a7 100644 (file)
@@ -6,7 +6,7 @@ title: VirtualMachine
 
 ...
 
-h1. VirtualMachine
+
 
 A **VirtualMachine** represents...
 
diff --git a/doc/css/code.css b/doc/css/code.css
new file mode 100644 (file)
index 0000000..59dc1be
--- /dev/null
@@ -0,0 +1,27 @@
+table.code {
+    font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
+    display: block;
+    padding: 9.5px;
+    margin: 0px 0px 10px;
+    font-size: 13px;
+    line-height: 1.42857;
+    color: rgb(51, 51, 51);
+    word-break: break-all;
+    word-wrap: break-word;
+    background-color: rgb(245, 245, 245);
+    border: 1px solid rgb(204, 204, 204);
+    border-radius: 4px 4px 4px 4px;
+}
+
+table.code tr td {
+    white-space: pre;
+}
+
+table.code tr td:nth-child(2) {
+    color: #d14;
+    padding-left: .5em;
+}
+
+.userinput {
+    color: #d14;
+}
index df79492a63e672df7d13320365af368d726c97d7..7ec25e401456ff6bb4b38283e2636c2965d51dde 100644 (file)
@@ -22,3 +22,7 @@
   text-shadow: 0 -1px 0 rgba(0,0,0,.2);
   background-color: rgb(66, 139, 202);
 }
+
+.spaced-out li {
+   padding-bottom: 1em; 
+}
\ No newline at end of file
index 42ba79df81e8ce34f9730d0e952fc71019af9856..3668f00ab39dd78fb6ebbeba99ea99a77eac500b 100644 (file)
@@ -5,39 +5,45 @@
    "script":"file-select",
    "script_parameters":{
     "names":[
-     "human_g1k_v37.fasta.gz", "human_g1k_v37.fasta.fai.gz", "human_g1k_v37.dict.gz"
+     "human_g1k_v37.fasta.gz",
+     "human_g1k_v37.fasta.fai.gz",
+     "human_g1k_v37.dict.gz"
     ],
     "input":"d237a90bae3870b3b033aea1e99de4a9+10820+K@qr1hi"
    },
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d"
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153"
   },
   "bwa-index":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"bwa-index",
    "script_parameters":{
     "input":{
      "output_of":"extract-reference"
     },
     "bwa_tbz":{
-     "optional":false
+     "value":"8b6e2c4916133e1d859c9e812861ce13+70",
+     "required":true
     }
    }
   },
   "bwa-aln":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"bwa-aln",
    "script_parameters":{
     "input":{
-     "optional":"false"
+     "dataclass":"Collection",
+     "required":"true"
     },
     "reference_index":{
      "output_of":"bwa-index"
     },
     "samtools_tgz":{
-     "optional":false
+     "value":"c777e23cf13e5d5906abfdc08d84bfdb+74",
+     "required":true
     },
     "bwa_tbz":{
-     "optional":false
+     "value":"8b6e2c4916133e1d859c9e812861ce13+70",
+     "required":true
     }
    },
    "runtime_constraints":{
    }
   },
   "picard-gatk2-prep":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"picard-gatk2-prep",
    "script_parameters":{
     "input":{
-      "output_of":"bwa-aln"
+     "output_of":"bwa-aln"
     },
     "reference":{
      "output_of":"extract-reference"
     },
     "picard_zip":{
-     "optional":false
+     "value":"687f74675c6a0e925dec619cc2bec25f+77",
+     "required":true
     }
    },
    "runtime_constraints":{
    }
   },
   "GATK2-realign":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"GATK2-realign",
    "script_parameters":{
     "input":{
-      "output_of":"picard-gatk2-prep"
+     "output_of":"picard-gatk2-prep"
     },
     "gatk_bundle":{
-     "optional":false
+     "value":"d237a90bae3870b3b033aea1e99de4a9+10820+K@qr1hi",
+     "required":true
     },
     "picard_zip":{
-     "optional":false
+     "value":"687f74675c6a0e925dec619cc2bec25f+77",
+     "required":true
     },
     "gatk_tbz":{
-     "optional":false
+     "value":"7e0a277d6d2353678a11f56bab3b13f2+87",
+     "required":true
     },
     "regions":{
-     "optional":true
+     "value":"13b53dbe1ec032dfc495fd974aa5dd4a+87/S02972011_Covered_sort_merged.bed"
     },
     "region_padding":{
-     "optional":true
+     "value":10
     }
    },
    "runtime_constraints":{
    }
   },
   "GATK2-bqsr":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"GATK2-bqsr",
    "script_parameters":{
     "input":{
-      "output_of":"GATK2-realign"
+     "output_of":"GATK2-realign"
     },
     "gatk_bundle":{
-     "optional":false
+     "value":"d237a90bae3870b3b033aea1e99de4a9+10820+K@qr1hi",
+     "required":true
     },
     "picard_zip":{
-     "optional":false
+     "value":"687f74675c6a0e925dec619cc2bec25f+77",
+     "required":true
     },
     "gatk_tbz":{
-     "optional":false
+     "value":"7e0a277d6d2353678a11f56bab3b13f2+87",
+     "required":true
     }
    }
   },
   "GATK2-merge-call":{
-   "script_version":"82a471c92036198aaf02ca0467ea48d49dbe822d",
+   "script_version":"e820bd1c6890f93ea1a84ffd5730bbf0e3d8e153",
    "script":"GATK2-merge-call",
    "script_parameters":{
     "input":{
-      "output_of":"GATK2-bqsr"
+     "output_of":"GATK2-bqsr"
     },
     "gatk_bundle":{
-     "optional":false
+     "value":"d237a90bae3870b3b033aea1e99de4a9+10820+K@qr1hi",
+     "required":true
     },
     "picard_zip":{
-     "optional":false
+     "value":"687f74675c6a0e925dec619cc2bec25f+77",
+     "required":true
     },
     "gatk_tbz":{
-     "optional":false
+     "value":"7e0a277d6d2353678a11f56bab3b13f2+87",
+     "required":true
     },
     "regions":{
-     "optional":true
+     "value":"13b53dbe1ec032dfc495fd974aa5dd4a+87/S02972011_Covered_sort_merged.bed"
     },
     "region_padding":{
-     "optional":true
+     "value":10
     },
     "GATK2_UnifiedGenotyper_args":{
-     "default":["-stand_call_conf","30.0","-stand_emit_conf","30.0","-dcov","200"]
+     "default":[
+      "-stand_call_conf",
+      "30.0",
+      "-stand_emit_conf",
+      "30.0",
+      "-dcov",
+      "200"
+     ]
     }
    }
   }
index 58fd03eb1acbdc08d1c907df6244aba75b546165..f9f51d67608a9d5687f6102daed8acb201460179 100644 (file)
@@ -26,19 +26,19 @@ title: Arvados | Documentation
     </div>
     <div class="col-sm-7" style="border-left: solid; border-width: 1px">
       <p>
-        <a href="{{ site.baseurl }}/user/">User Guide</a> &mdash; How to manage data and do analysis with Arvados.
+        <a href="{{ site.baseurl }}/user/index.html">User Guide</a> &mdash; How to manage data and do analysis with Arvados.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/sdk/">SDK Reference</a> &mdash; Details about the accessing Arvados from various programming languages.
+        <a href="{{ site.baseurl }}/sdk/index.html">SDK Reference</a> &mdash; Details about the accessing Arvados from various programming languages.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/api/">API Reference</a> &mdash; Details about the the Arvados REST API.
+        <a href="{{ site.baseurl }}/api/index.html">API Reference</a> &mdash; Details about the the Arvados REST API.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/admin/">Admin Guide</a> &mdash; How to administer an Arvados system.
+        <a href="{{ site.baseurl }}/admin/index.html">Admin Guide</a> &mdash; How to administer an Arvados system.
       </p>
       <p>
-        <a href="{{ site.baseurl }}/install/">Install Guide</a> &mdash; How to install Arvados on a cloud platform.
+        <a href="{{ site.baseurl }}/install/index.html">Install Guide</a> &mdash; How to install Arvados on a cloud platform.
       </p>      
     </div>
   </div>
index f8d864af45804ba94fb9372db33d2af70e087f26..b395d060f565c351502403ddc0f8dffd84b26ce3 100644 (file)
@@ -5,7 +5,7 @@ title: Install client libraries
 
 ...
 
-h1. Install client libraries
+
 
 h3. Python
 
index e8018b215df54a149caaf91cded8d1b574741618..678127bbfad97fbb0b90e9e7e725746d2042b9c8 100644 (file)
@@ -5,7 +5,7 @@ title: Create standard objects
 
 ...
 
-h1. Create standard objects
+
 
 h3. "All users" group
 
index f11cac9cea0373fc957d3f3d220284d697b249a8..aaac7a729084b8b1f9b898a12936107c2dae9f14 100644 (file)
@@ -10,6 +10,7 @@ title: Overview
 
 1. Set up a cluster, or use Amazon
 1. Create and mount Keep volumes
+1. [Install the Single Sign On (SSO) server](install-sso.html)
 1. [Install the Arvados REST API server](install-api-server.html)
 1. [Install the Arvados workbench application](install-workbench-app.html)
 1. [Install the Crunch dispatcher](install-crunch-dispatch.html)
diff --git a/doc/install/install-api-server.html.md.liquid b/doc/install/install-api-server.html.md.liquid
deleted file mode 100644 (file)
index 582feb9..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
----
-layout: default
-navsection: installguide
-title: Install the API server
-navorder: 1
-...
-
-# API server setup
-
-## Prerequisites:
-
-1. A GNU/Linux (virtual) machine
-2. A domain name for your api server
-3. Ruby >= 2.0.0
-4. Bundler
-
-## Download the source tree
-
-    git clone https://github.com/curoverse/arvados.git
-
-See also: [Downloading the source code](https://arvados.org/projects/arvados/wiki/Download) on the Arvados wiki.
-
-## Configure the API server
-
-First install the gems:
-
-    cd arvados/services/api
-    bundle install
-
-Next, configure the database:
-
-    cp -i config/database.yml.sample config/database.yml
-
-Edit `database.yml` to your liking and make sure the database and db user exist.
-Then set up the database:
-    RAILS_ENV=production rake db:setup
-
-Then set up omniauth:
-
-    cp -i config/initializers/omniauth.rb.example config/initializers/omniauth.rb
-
-Edit `config/initializers/omniauth.rb`. Choose an *APP_SECRET* and
-*APP_ID*. Also set *CUSTOM_PROVIDER_URL*.
-
-Make sure your Omniauth provider knows about your *APP_ID* and *APP_SECRET*
-combination.
-
-You also need to update `config/initializers/secret_token.rb`.
-Generate a new secret with
-
-    rake secret
-
-and put it in `config/initializers/secret_token.rb`:
-
-    Server::Application.config.secret_token = 'your-new-secret-here'
-
-Edit the main configuration:
-
-    cp -i config/config.yml.example config/config.yml
-
-First, you want to make sure that
-
-    uuid_prefix
-
-is set to a unique 5-character alphanumeric string. An example is
-given that generates a 5-character string based on a hash of your
-hostname.
-
-The `uuid_prefix` is a unique identifier for your API server. It also
-serves as the first part of the hostname for your API server, for
-instance
-
-    {{ site.arvados_api_host }}
-
-For a development site, use your own domain instead of arvadosapi.com.
-
-You will also want to change `compute_node_nameservers` to suit your
-environment.
-
-Consult `config.defaults.yml` for a full list of configuration
-options. Always put your local configuration in `config.yml` instead
-of editing `config.defaults.yml`.
-
-## Apache/Passenger
-
-Set up Apache and Passenger. Point them to the services/api directory in the source tree.
-
-To enable streaming so users can monitor crunch jobs in real time, add
-to your Apache configuration:
-
-    PassengerBufferResponse off
-
-## Add an admin user
-
-Point browser to the API endpoint. Log in with a google account.
-
-In the rails console:
-
-    Thread.current[:user] = User.find(1)
-    Thread.current[:user].is_admin = true
-    User.find(1).update_attributes is_admin: true, is_active: true
-    User.find(1).is_admin
-
-This should be
-
-     => true
-
-## Create a token
-
-In rails console
-
-     a = ApiClient.new(owner_uuid:'0'); a.save!
-     x = ApiClientAuthorization.new(api_client_id:a.id, user_id:1); x.save; x.api_token
-
diff --git a/doc/install/install-api-server.html.textile.liquid b/doc/install/install-api-server.html.textile.liquid
new file mode 100644 (file)
index 0000000..ccfc58e
--- /dev/null
@@ -0,0 +1,128 @@
+---
+layout: default
+navsection: installguide
+title: Install the API server
+...
+
+h2. Prerequisites:
+
+# A GNU/Linux (virtual) machine
+# A domain name for your api server
+# Ruby >= 2.0.0
+# Bundler: @gem install bundler@
+# Curl libraries: @sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev@
+
+h2. Download the source tree
+
+<notextile>
+<pre><code>~$ <span class="userinput">git clone https://github.com/curoverse/arvados.git</span>
+</code></pre></notextile>
+
+See also: "Downloading the source code:https://arvados.org/projects/arvados/wiki/Download on the Arvados wiki.
+
+h2. Install gem dependencies
+
+<notextile>
+<pre><code>~$ <span class="userinput">cd arvados/services/api</span>
+~/arvados/services/api$ <span class="userinput">bundle install</span>
+</code></pre></notextile>
+
+h2. Configure the API server
+
+Edit the main configuration:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">cp -i config/application.yml.example config/application.yml</span>
+</code></pre></notextile>
+
+Choose a unique 5-character alphanumeric string to use as your @uuid_prefix@. An example is given that generates a 5-character string based on a hash of your hostname. The @uuid_prefix@ is a unique identifier for your API server. It also serves as the first part of the hostname for your API server.
+
+For a development site, use your own domain instead of arvadosapi.com.
+
+Make sure a clone of the arvados repository exists in @git_repositories_dir@:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">sudo mkdir -p /var/cache/git</span>
+~/arvados/services/api$ <span class="userinput">sudo git clone --bare ../../.git /var/cache/git/arvados.git</span>
+</code></pre></notextile>
+
+Generate a new secret token for signing cookies:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">rake secret
+zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
+</code></pre></notextile>
+
+Put it in @config/application.yml@ in the production or common section:
+
+<notextile>
+<pre><code><span class="userinput">    secret_token: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</span>
+</code></pre>
+</notextile>
+
+Consult @application.default.yml@ for a full list of configuration options. Always put your local configuration in @application.yml@ instead of editing @application.default.yml@.
+
+Configure the database:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">cp -i config/database.yml.sample config/database.yml</span>
+</code></pre></notextile>
+
+By default, the development database will use the sqlite3 driver, so no configuration is necessary.  If you wish to use mysql or postgres, edit @config/database.yml@ to your liking and make sure the database and db user exist. Then initialize the database:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">RAILS_ENV=development bundle exec rake db:setup</span>
+</code></pre></notextile>
+
+Set up omniauth:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">cp -i config/initializers/omniauth.rb.example config/initializers/omniauth.rb
+</code></pre></notextile>
+
+Edit @config/initializers/omniauth.rb@. Set @APP_SECRET@ to the value of @app_secret@ from "installing the single sign on server":install-sso.html .
+
+You can now run the development server:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">rails server
+</code></pre></notextile>
+
+h3. Apache/Passenger (optional)
+
+You can use "Passenger":https://www.phusionpassenger.com/ for deployment. Point it to the services/api directory in the source tree.
+
+To enable streaming so users can monitor crunch jobs in real time, add to your Passenger configuration in Apache:
+
+<notextile>
+<pre><code><span class="userinput">PassengerBufferResponse off</span>
+</code></pre>
+</notextile>
+
+h2. Add an admin user
+
+Point browser to the API endpoint. Log in with a google account.
+
+In the rails console:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">rails console</span>
+irb(main):001:0&gt; <span class="userinput">Thread.current[:user] = User.find(1)</span>
+irb(main):002:0&gt; <span class="userinput">Thread.current[:user].is_admin = true</span>
+irb(main):003:0&gt; <span class="userinput">User.find(1).update_attributes is_admin: true, is_active: true</span>
+irb(main):004:0&gt; <span class="userinput">User.find(1).is_admin</span>
+=&gt; true
+</code></pre></notextile>
+
+h2. Create an API token
+
+In rails console:
+
+<notextile>
+<pre><code>~/arvados/services/api$ <span class="userinput">rails console</span>
+irb(main):001:0&gt; <span class="userinput">a = ApiClient.new(owner_uuid:'0')</span>
+irb(main):002:0&gt; <span class="userinput">a.save!</span>
+irb(main):003:0&gt; <span class="userinput">x = ApiClientAuthorization.new(api_client_id:a.id, user_id:1)</span>
+irb(main):004:0&gt; <span class="userinput">x.save</span>
+irb(main):005:0&gt; <span class="userinput">x.api_token</span>
+</code></pre></notextile>
index 4905b45dce0111932fb99d6810a7847f7e1f2821..9b0e9b82a1f39ee222a5fe88d4bd8f950f74be3c 100644 (file)
@@ -5,7 +5,7 @@ title: Install the Crunch dispatcher
 
 ...
 
-h1. Crunch setup
+
 
 The dispatcher normally runs on the same host/VM as the API server.
 
diff --git a/doc/install/install-sso.html.textile.liquid b/doc/install/install-sso.html.textile.liquid
new file mode 100644 (file)
index 0000000..f220ef6
--- /dev/null
@@ -0,0 +1,24 @@
+---
+layout: default
+navsection: installguide
+title: Install Single Sign On (SSO) server
+...
+
+<notextile>
+<pre><code>~$ <span class="userinput">git clone https://github.com/curoverse/sso-devise-omniauth-provider.git</span>
+~$ <span class="userinput">cd sso-devise-omniauth-provider</span>
+~/sso-devise-omniauth-provider$ <span class="userinput">bundle install</span>
+~/sso-devise-omniauth-provider$ <span class="userinput">rake db:create</span>
+~/sso-devise-omniauth-provider$ <span class="userinput">rake db:migrate</span>
+~/sso-devise-omniauth-provider$ <span class="userinput">rake secret</span>
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+~/sso-devise-omniauth-provider$ <span class="userinput">rails console</span>
+irb(main):001:0&gt; <span class="userinput">c = Client.new</span>
+irb(main):002:0&gt; <span class="userinput">c.name = "joshid"</span>
+irb(main):003:0&gt; <span class="userinput">c.app_id = "arvados-server"</span>
+irb(main):004:0&gt; <span class="userinput">c.app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span>
+irb(main):005:0&gt; <span class="userinput">c.save!</span>
+irb(main):006:0&gt; <span class="userinput">quit</span>
+~/sso-devise-omniauth-provider$ <span class="userinput">rails server --port=3002</span>
+</code></pre>
+</notextile>
diff --git a/doc/install/install-workbench-app.html.md.liquid b/doc/install/install-workbench-app.html.md.liquid
deleted file mode 100644 (file)
index d34d54f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
----
-layout: default
-navsection: installguide
-title: Install the Arvados workbench application
-navorder: 2
-...
-
-{% include 'alert_stub' %}
-
-# Workbench setup
-
-## Prerequisites
-
-1. A GNU/linux (virtual) machine (can be shared with the API server)
-2. A hostname for your workbench application
-
-## Download the source tree
-
-Please follow the instructions on the [Download page](https://arvados.org/projects/arvados/wiki/Download) in the wiki.
-
-The workbench application is in `apps/workbench`.
-
-## Configure the Workbench application
-
-You need to update config/initializers/secret_token.rb. Generate a new secret with
-
-    rake secret
-
-and put it in `config/initializers/secret_token.rb`
-
-    Server::Application.config.secret_token = 'your-new-secret-here'
-
-Adjust the following fields in your `environments/production.rb` file.
-
-* `config.site_name` can be the URL of your workbench install.
-* `config.arvados_login_base` and `config.arvados_v1_base` should point to
-your API server. Use the example values as a guide.
-* If you choose not to use https, make sure to also set
-`config.force_ssl = false` in the API server's `production.rb` file.
-
-Copy `config/piwik.yml.example` to `config/piwik.yml` and edit to suit.
-
-## Apache/Passenger
-
-Set up Apache and Passenger. Point them to the apps/workbench directory in the source tree.
-
-## "Trusted client" setting
-
-Log in to Workbench once (this ensures that the Arvados API server has
-a record of the Workbench client).
-
-In the API server project root, start the rails console.
-
-    RAILS_ENV=production bundle exec rails c
-
-Locate the ApiClient record for your Workbench installation.
-
-    ApiClient.where('url_prefix like ?', '%workbench%')
-
-Set the `is_trusted` flag for the appropriate client record.
-
-    ApiClient.find(1234).update_attributes is_trusted: true
-
diff --git a/doc/install/install-workbench-app.html.textile.liquid b/doc/install/install-workbench-app.html.textile.liquid
new file mode 100644 (file)
index 0000000..be6a04d
--- /dev/null
@@ -0,0 +1,52 @@
+---
+layout: default
+navsection: installguide
+title: Install the Arvados Workbench application
+...
+
+h2. Prerequisites
+
+# A GNU/linux (virtual) machine (can be shared with the API server)
+# A hostname for your Workbench application
+
+h2. Download the source tree
+
+Please follow the instructions on the "Download page":https://arvados.org/projects/arvados/wiki/Download in the wiki.
+
+The Workbench application is in @arvados/apps/workbench@.
+
+h2. Configure the Workbench application
+
+This application needs a secret token. Generate a new secret:
+
+<notextile>
+<pre><code>~/arvados/apps/workbench$ <span class="userinput">rake secret</span>
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+</code></pre>
+</notextile>
+
+Copy @config/application.yml.example@ to @config/application.yml@ and edit it appropriately for your environment.
+
+* Set @secret_token@ to the string you generated with @rake secret@.
+* Point @arvados_login_base@ and @arvados_v1_base@ at your "API server":install-api-server.html
+* @site_name@ can be any string to identify this Workbench.
+* Assuming that the SSL certificate you use for development isn't signed by a CA, make sure @arvados_insecure_https@ is @true@.
+
+Copy @config/piwik.yml.example@ to @config/piwik.yml@ and edit to suit.
+
+h3. Apache/Passenger (optional)
+
+Set up Apache and Passenger. Point them to the apps/workbench directory in the source tree.
+
+h2. Trusted client setting
+
+Log in to Workbench once (this ensures that the Arvados API server has a record of the Workbench client).
+
+In the API server project root, start the rails console.  Locate the ApiClient record for your Workbench installation, then set the `is_trusted` flag for the appropriate client record:
+
+<notextile><pre><code>~/arvados/services/api$ <span class="userinput">RAILS_ENV=development bundle exec rails console</span>
+irb(main):001:0&gt; <span class="userinput">ApiClient.where('url_prefix like ?', '%workbench%')</span>
+=&gt; {:id => 1234}
+irb(main):002:0&gt; <span class="userinput">ApiClient.find(1234).update_attributes is_trusted: true</span>
+</code></pre>
+</notextile>
index 7da1bd5c65e4e77502d94722c592659099c6ec10..7a81f1dcbd48fa060ef298d1b531598b76877385 100644 (file)
@@ -1,12 +1,9 @@
 ---
 layout: default
 navsection: sdk
-title: "SDK Reference"
-
+title: "Arvados SDK Reference"
 ...
 
-h1. Arvados SDK Reference
-
 This section documents how to access the Arvados API and Keep using various programming languages.
 
 * "Python SDK":python/sdk-python.html
index a897e9487da05960d6af70fdb63a1ea06e7fc94f..e7f360394fec349270ce6cc76b6bc8d179c0c85a 100644 (file)
@@ -6,8 +6,6 @@ title: "Crunch utility libraries"
 
 ...
 
-h1. Crunch utility libraries
-
 Several utility libraries are included with Arvados. They are intended to make it quicker and easier to write your own crunch scripts.
 
 * "Python SDK extras":#pythonsdk
index 911f03220691d8798accc811d0c8a26821c8ccbf..09af1a323899f8f812bf3ac1d5c17c4814a34258 100644 (file)
@@ -6,8 +6,6 @@ title: "Python SDK"
 
 ...
 
-h1. Python SDK
-
 The Python SDK provides a generic set of wrappers so you can make API calls easily. It performs some validation before connecting to the API server: for example, it refuses to do an API call if a required parameter is missing.
 
 The library also includes some conveniences for use in Crunch scripts; see "Crunch utility libraries":crunch-utility-libraries.html for details.
@@ -22,11 +20,19 @@ h4. Option 1: install with PyPI
 
 <notextile>
 <pre>
-$ <code class="userinput">sudo apt-get install python-dev libattr1-dev libfuse-dev pkg-config</code>
+$ <code class="userinput">sudo apt-get install python-pip python-dev libattr1-dev libfuse-dev pkg-config</code>
 $ <code class="userinput">sudo pip install arvados-python-client</code>
 </pre>
 </notextile>
 
+_If your version of @pip@ is 1.4 or newer, the @pip install@ command might give an error: "Could not find a version that satisfies the requirement arvados-python-client". If this happens, fix it by adding a @--pre@ flag:_
+
+<notextile>
+<pre>
+$ <code class="userinput">sudo pip install --pre arvados-python-client</code>
+</pre>
+</notextile>
+
 h4. Option 2: build and install from source
 
 <notextile>
diff --git a/doc/user/copying/LICENSE-2.0.html b/doc/user/copying/LICENSE-2.0.html
new file mode 100644 (file)
index 0000000..129916f
--- /dev/null
@@ -0,0 +1,182 @@
+---
+layout: default
+navsection: userguide
+title: "Apache License"
+...
+
+<div id="content" class="grid_16"><div class="section-content"></br>Version 2.0, January 2004<br></br>
+<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p>
+<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
+<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
+<p>"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.</p>
+<p>"Licensor" shall mean the copyright owner or entity authorized by the
+copyright owner that is granting the License.</p>
+<p>"Legal Entity" shall mean the union of the acting entity and all other
+entities that control, are controlled by, or are under common control with
+that entity. For the purposes of this definition, "control" means (i) the
+power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty
+percent (50%) or more of the outstanding shares, or (iii) beneficial
+ownership of such entity.</p>
+<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.</p>
+<p>"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.</p>
+<p>"Object" form shall mean any form resulting from mechanical transformation
+or translation of a Source form, including but not limited to compiled
+object code, generated documentation, and conversions to other media types.</p>
+<p>"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice that
+is included in or attached to the work (an example is provided in the
+Appendix below).</p>
+<p>"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent, as
+a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from, or
+merely link (or bind by name) to the interfaces of, the Work and Derivative
+Works thereof.</p>
+<p>"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor for
+inclusion in the Work by the copyright owner or by an individual or Legal
+Entity authorized to submit on behalf of the copyright owner. For the
+purposes of this definition, "submitted" means any form of electronic,
+verbal, or written communication sent to the Licensor or its
+representatives, including but not limited to communication on electronic
+mailing lists, source code control systems, and issue tracking systems that
+are managed by, or on behalf of, the Licensor for the purpose of discussing
+and improving the Work, but excluding communication that is conspicuously
+marked or otherwise designated in writing by the copyright owner as "Not a
+Contribution."</p>
+<p>"Contributor" shall mean Licensor and any individual or Legal Entity on
+behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.</p>
+<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. Subject to the
+terms and conditions of this License, each Contributor hereby grants to You
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of, publicly
+display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.</p>
+<p><strong><a name="patent">3. Grant of Patent License</a></strong>. Subject to the terms
+and conditions of this License, each Contributor hereby grants to You a
+perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made, use,
+offer to sell, sell, import, and otherwise transfer the Work, where such
+license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by
+combination of their Contribution(s) with the Work to which such
+Contribution(s) was submitted. If You institute patent litigation against
+any entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that the Work or a Contribution incorporated within the Work constitutes
+direct or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate as of the
+date such litigation is filed.</p>
+<p><strong><a name="redistribution">4. Redistribution</a></strong>. You may reproduce and
+distribute copies of the Work or Derivative Works thereof in any medium,
+with or without modifications, and in Source or Object form, provided that
+You meet the following conditions:</p>
+<ol style="list-style: lower-latin;">
+<li>You must give any other recipients of the Work or Derivative Works a
+copy of this License; and</li>
+
+<li>You must cause any modified files to carry prominent notices stating
+that You changed the files; and</li>
+
+<li>You must retain, in the Source form of any Derivative Works that You
+distribute, all copyright, patent, trademark, and attribution notices from
+the Source form of the Work, excluding those notices that do not pertain to
+any part of the Derivative Works; and</li>
+
+<li>If the Work includes a "NOTICE" text file as part of its distribution,
+then any Derivative Works that You distribute must include a readable copy
+of the attribution notices contained within such NOTICE file, excluding
+those notices that do not pertain to any part of the Derivative Works, in
+at least one of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or documentation,
+if provided along with the Derivative Works; or, within a display generated
+by the Derivative Works, if and wherever such third-party notices normally
+appear. The contents of the NOTICE file are for informational purposes only
+and do not modify the License. You may add Your own attribution notices
+within Derivative Works that You distribute, alongside or as an addendum to
+the NOTICE text from the Work, provided that such additional attribution
+notices cannot be construed as modifying the License.
+<br/>
+<br/>
+You may add Your own copyright statement to Your modifications and may
+provide additional or different license terms and conditions for use,
+reproduction, or distribution of Your modifications, or for any such
+Derivative Works as a whole, provided Your use, reproduction, and
+distribution of the Work otherwise complies with the conditions stated in
+this License.
+</li>
+
+</ol>
+
+<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. Unless You
+explicitly state otherwise, any Contribution intentionally submitted for
+inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the
+terms of any separate license agreement you may have executed with Licensor
+regarding such Contributions.</p>
+<p><strong><a name="trademarks">6. Trademarks</a></strong>. This License does not grant
+permission to use the trade names, trademarks, service marks, or product
+names of the Licensor, except as required for reasonable and customary use
+in describing the origin of the Work and reproducing the content of the
+NOTICE file.</p>
+<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. Unless required by
+applicable law or agreed to in writing, Licensor provides the Work (and
+each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
+without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
+are solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise
+of permissions under this License.</p>
+<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. In no event and
+under no legal theory, whether in tort (including negligence), contract, or
+otherwise, unless required by applicable law (such as deliberate and
+grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a result
+of this License or out of the use or inability to use the Work (including
+but not limited to damages for loss of goodwill, work stoppage, computer
+failure or malfunction, or any and all other commercial damages or losses),
+even if such Contributor has been advised of the possibility of such
+damages.</p>
+<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>.
+While redistributing the Work or Derivative Works thereof, You may choose
+to offer, and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this License.
+However, in accepting such obligations, You may act only on Your own behalf
+and on Your sole responsibility, not on behalf of any other Contributor,
+and only if You agree to indemnify, defend, and hold each Contributor
+harmless for any liability incurred by, or claims asserted against, such
+Contributor by reason of your accepting any such warranty or additional
+liability.</p>
+<p>END OF TERMS AND CONDITIONS</p>
+<h1 id="apply">APPENDIX: How to apply the Apache License to your work</h1>
+<p>To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included
+on the same "printed page" as the copyright notice for easier
+identification within third-party archives.</p>
+<div class="codehilite"><pre>Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+</pre></div></div></div>
diff --git a/doc/user/copying/agpl-3.0.html b/doc/user/copying/agpl-3.0.html
new file mode 100644 (file)
index 0000000..8b04e0a
--- /dev/null
@@ -0,0 +1,684 @@
+---
+layout: default
+navsection: userguide
+title: "GNU Affero General Public License"
+...
+
+<p style="text-align: center;">Version 3, 19 November 2007</p>
+
+<p>Copyright &copy; 2007 Free Software Foundation,
+Inc. &lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;
+ <br />
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.</p>
+
+<h3><a name="preamble"></a>Preamble</h3>
+
+<p>The GNU Affero General Public License is a free, copyleft license
+for software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.</p>
+
+<p>The licenses for most software and other practical works are
+designed to take away your freedom to share and change the works.  By
+contrast, our General Public Licenses are intended to guarantee your
+freedom to share and change all versions of a program--to make sure it
+remains free software for all its users.</p>
+
+<p>When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.</p>
+
+<p>Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.</p>
+
+<p>A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.</p>
+
+<p>The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.</p>
+
+<p>An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.</p>
+
+<p>The precise terms and conditions for copying, distribution and
+modification follow.</p>
+
+<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
+
+<h4><a name="section0"></a>0. Definitions.</h4>
+
+<p>&quot;This License&quot; refers to version 3 of the GNU Affero General Public
+License.</p>
+
+<p>&quot;Copyright&quot; also means copyright-like laws that apply to other kinds
+of works, such as semiconductor masks.</p>
+
+<p>&quot;The Program&quot; refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as &quot;you&quot;.  &quot;Licensees&quot; and
+&quot;recipients&quot; may be individuals or organizations.</p>
+
+<p>To &quot;modify&quot; a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a &quot;modified version&quot; of the
+earlier work or a work &quot;based on&quot; the earlier work.</p>
+
+<p>A &quot;covered work&quot; means either the unmodified Program or a work based
+on the Program.</p>
+
+<p>To &quot;propagate&quot; a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.</p>
+
+<p>To &quot;convey&quot; a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.</p>
+
+<p>An interactive user interface displays &quot;Appropriate Legal Notices&quot;
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.</p>
+
+<h4><a name="section1"></a>1. Source Code.</h4>
+
+<p>The &quot;source code&quot; for a work means the preferred form of the work
+for making modifications to it.  &quot;Object code&quot; means any non-source
+form of a work.</p>
+
+<p>A &quot;Standard Interface&quot; means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.</p>
+
+<p>The &quot;System Libraries&quot; of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+&quot;Major Component&quot;, in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.</p>
+
+<p>The &quot;Corresponding Source&quot; for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.</p>
+
+<p>The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.</p>
+
+<p>The Corresponding Source for a work in source code form is that
+same work.</p>
+
+<h4><a name="section2"></a>2. Basic Permissions.</h4>
+
+<p>All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.</p>
+
+<p>You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.</p>
+
+<p>Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.</p>
+
+<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
+
+<p>No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.</p>
+
+<p>When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.</p>
+
+<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
+
+<p>You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.</p>
+
+<p>You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.</p>
+
+<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
+
+<p>You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:</p>
+
+<ul>
+
+<li>a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.</li>
+
+<li>b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    &quot;keep intact all notices&quot;.</li>
+
+<li>c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.</li>
+
+<li>d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.</li>
+
+</ul>
+
+<p>A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+&quot;aggregate&quot; if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.</p>
+
+<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
+
+<p>You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:</p>
+
+<ul>
+
+<li>a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.</li>
+
+<li>b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.</li>
+
+<li>c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.</li>
+
+<li>d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.</li>
+
+<li>e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.</li>
+
+</ul>
+
+<p>A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.</p>
+
+<p>A &quot;User Product&quot; is either (1) a &quot;consumer product&quot;, which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, &quot;normally used&quot; refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.</p>
+
+<p>&quot;Installation Information&quot; for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.</p>
+
+<p>If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).</p>
+
+<p>The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.</p>
+
+<p>Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.</p>
+
+<h4><a name="section7"></a>7. Additional Terms.</h4>
+
+<p>&quot;Additional permissions&quot; are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.</p>
+
+<p>When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.</p>
+
+<p>Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:</p>
+
+<ul>
+
+<li>a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or</li>
+
+<li>b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or</li>
+
+<li>c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or</li>
+
+<li>d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or</li>
+
+<li>e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or</li>
+
+<li>f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.</li>
+
+</ul>
+
+<p>All other non-permissive additional terms are considered &quot;further
+restrictions&quot; within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further restriction,
+you may remove that term.  If a license document contains a further
+restriction but permits relicensing or conveying under this License, you
+may add to a covered work material governed by the terms of that license
+document, provided that the further restriction does not survive such
+relicensing or conveying.</p>
+
+<p>If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.</p>
+
+<p>Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.</p>
+
+<h4><a name="section8"></a>8. Termination.</h4>
+
+<p>You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).</p>
+
+<p>However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.</p>
+
+<p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.</p>
+
+<p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.</p>
+
+<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
+
+<p>You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.</p>
+
+<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
+
+<p>Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.</p>
+
+<p>An &quot;entity transaction&quot; is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.</p>
+
+<p>You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.</p>
+
+<h4><a name="section11"></a>11. Patents.</h4>
+
+<p>A &quot;contributor&quot; is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's &quot;contributor version&quot;.</p>
+
+<p>A contributor's &quot;essential patent claims&quot; are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, &quot;control&quot; includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.</p>
+
+<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.</p>
+
+<p>In the following three paragraphs, a &quot;patent license&quot; is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To &quot;grant&quot; such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.</p>
+
+<p>If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  &quot;Knowingly relying&quot; means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.</p>
+
+<p>If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.</p>
+
+<p>A patent license is &quot;discriminatory&quot; if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.</p>
+
+<p>Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.</p>
+
+<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
+
+<p>If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.</p>
+
+<h4><a name="section13"></a>13. Remote Network Interaction; Use with the GNU General Public License.</h4>
+
+<p>Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.</p>
+
+<p>Notwithstanding any other provision of this License, you have permission
+to link or combine any covered work with a work licensed under version 3
+of the GNU General Public License into a single combined work, and to
+convey the resulting work.  The terms of this License will continue to
+apply to the part which is the covered work, but the work with which it is
+combined will remain governed by version 3 of the GNU General Public
+License.</p>
+
+<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
+
+<p>The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new
+versions will be similar in spirit to the present version, but may differ
+in detail to address new problems or concerns.</p>
+
+<p>Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero
+General Public License &quot;or any later version&quot; applies to it, you have
+the option of following the terms and conditions either of that
+numbered version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number
+of the GNU Affero General Public License, you may choose any version
+ever published by the Free Software Foundation.</p>
+
+<p>If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that
+proxy's public statement of acceptance of a version permanently
+authorizes you to choose that version for the Program.</p>
+
+<p>Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.</p>
+
+<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
+
+<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM &quot;AS IS&quot; WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
+
+<h4><a name="section16"></a>16. Limitation of Liability.</h4>
+
+<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.</p>
+
+<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
+
+<p>If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.</p>
+
+<p>END OF TERMS AND CONDITIONS</p>
+
+<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
+
+<p>If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.</p>
+
+<p>To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the &quot;copyright&quot; line and a pointer to where the full notice is found.</p>
+
+<pre>    &lt;one line to give the program's name and a brief idea of what it does.&gt;
+    Copyright (C) &lt;year&gt;  &lt;name of author&gt;
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
+</pre>
+
+<p>Also add information on how to contact you by electronic and paper mail.</p>
+
+<p>If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a &quot;Source&quot; link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.</p>
+
+<p>You should also get your employer (if you work as a programmer) or school,
+if any, to sign a &quot;copyright disclaimer&quot; for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
+
+
diff --git a/doc/user/copying/by-sa-3.0.html b/doc/user/copying/by-sa-3.0.html
new file mode 100644 (file)
index 0000000..f88374a
--- /dev/null
@@ -0,0 +1,418 @@
+---
+layout: default
+navsection: userguide
+title: "Creative Commons"
+...
+
+<div id="deed" class="green">
+    <div id="deed-head">
+
+      <div id="deed-license">
+        <h2>Attribution-ShareAlike 3.0 United States</h2>
+      </div>
+    </div>
+
+        <h3><em>License</em></h3>
+
+        <p>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS
+        OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR
+        "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER
+        APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
+        AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
+        PROHIBITED.</p>
+
+        <p>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU
+        ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE.
+        TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A
+        CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE
+        IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
+        CONDITIONS.</p>
+
+        <p><strong>1. Definitions</strong></p>
+
+        <ol type="a">
+          <li><strong>"Collective Work"</strong> means a work, such
+          as a periodical issue, anthology or encyclopedia, in
+          which the Work in its entirety in unmodified form, along
+          with one or more other contributions, constituting
+          separate and independent works in themselves, are
+          assembled into a collective whole. A work that
+          constitutes a Collective Work will not be considered a
+          Derivative Work (as defined below) for the purposes of
+          this License.</li>
+
+          <li><strong>"Creative Commons Compatible
+          License"</strong> means a license that is listed at
+          http://creativecommons.org/compatiblelicenses that has
+          been approved by Creative Commons as being essentially
+          equivalent to this License, including, at a minimum,
+          because that license: (i) contains terms that have the
+          same purpose, meaning and effect as the License Elements
+          of this License; and, (ii) explicitly permits the
+          relicensing of derivatives of works made available under
+          that license under this License or either a Creative
+          Commons unported license or a Creative Commons
+          jurisdiction license with the same License Elements as
+          this License.</li>
+
+          <li><strong>"Derivative Work"</strong> means a work based
+          upon the Work or upon the Work and other pre-existing
+          works, such as a translation, musical arrangement,
+          dramatization, fictionalization, motion picture version,
+          sound recording, art reproduction, abridgment,
+          condensation, or any other form in which the Work may be
+          recast, transformed, or adapted, except that a work that
+          constitutes a Collective Work will not be considered a
+          Derivative Work for the purpose of this License. For the
+          avoidance of doubt, where the Work is a musical
+          composition or sound recording, the synchronization of
+          the Work in timed-relation with a moving image
+          ("synching") will be considered a Derivative Work for the
+          purpose of this License.</li>
+
+          <li><strong>"License Elements"</strong> means the
+          following high-level license attributes as selected by
+          Licensor and indicated in the title of this License:
+          Attribution, ShareAlike.</li>
+
+          <li><strong>"Licensor"</strong> means the individual,
+          individuals, entity or entities that offers the Work
+          under the terms of this License.</li>
+
+          <li><strong>"Original Author"</strong> means the
+          individual, individuals, entity or entities who created
+          the Work.</li>
+
+          <li><strong>"Work"</strong> means the copyrightable work
+          of authorship offered under the terms of this
+          License.</li>
+
+          <li><strong>"You"</strong> means an individual or entity
+          exercising rights under this License who has not
+          previously violated the terms of this License with
+          respect to the Work, or who has received express
+          permission from the Licensor to exercise rights under
+          this License despite a previous violation.</li>
+        </ol>
+
+        <p><strong>2. Fair Use Rights.</strong> Nothing in this
+        license is intended to reduce, limit, or restrict any
+        rights arising from fair use, first sale or other
+        limitations on the exclusive rights of the copyright owner
+        under copyright law or other applicable laws.</p>
+
+        <p><strong>3. License Grant.</strong> Subject to the terms
+        and conditions of this License, Licensor hereby grants You
+        a worldwide, royalty-free, non-exclusive, perpetual (for
+        the duration of the applicable copyright) license to
+        exercise the rights in the Work as stated below:</p>
+
+        <ol type="a">
+          <li>to reproduce the Work, to incorporate the Work into
+          one or more Collective Works, and to reproduce the Work
+          as incorporated in the Collective Works;</li>
+
+          <li>to create and reproduce Derivative Works provided
+          that any such Derivative Work, including any translation
+          in any medium, takes reasonable steps to clearly label,
+          demarcate or otherwise identify that changes were made to
+          the original Work. For example, a translation could be
+          marked "The original work was translated from English to
+          Spanish," or a modification could indicate "The original
+          work has been modified.";</li>
+
+          <li>to distribute copies or phonorecords of, display
+          publicly, perform publicly, and perform publicly by means
+          of a digital audio transmission the Work including as
+          incorporated in Collective Works;</li>
+
+          <li>to distribute copies or phonorecords of, display
+          publicly, perform publicly, and perform publicly by means
+          of a digital audio transmission Derivative Works.</li>
+
+          <li>
+            <p>For the avoidance of doubt, where the Work is a
+            musical composition:</p>
+
+            <ol type="i">
+              <li><strong>Performance Royalties Under Blanket
+              Licenses</strong>. Licensor waives the exclusive
+              right to collect, whether individually or, in the
+              event that Licensor is a member of a performance
+              rights society (e.g. ASCAP, BMI, SESAC), via that
+              society, royalties for the public performance or
+              public digital performance (e.g. webcast) of the
+              Work.</li>
+
+              <li><strong>Mechanical Rights and Statutory
+              Royalties</strong>. Licensor waives the exclusive
+              right to collect, whether individually or via a music
+              rights agency or designated agent (e.g. Harry Fox
+              Agency), royalties for any phonorecord You create
+              from the Work ("cover version") and distribute,
+              subject to the compulsory license created by 17 USC
+              Section 115 of the US Copyright Act (or the
+              equivalent in other jurisdictions).</li>
+            </ol>
+          </li>
+
+          <li><strong>Webcasting Rights and Statutory
+          Royalties</strong>. For the avoidance of doubt, where the
+          Work is a sound recording, Licensor waives the exclusive
+          right to collect, whether individually or via a
+          performance-rights society (e.g. SoundExchange),
+          royalties for the public digital performance (e.g.
+          webcast) of the Work, subject to the compulsory license
+          created by 17 USC Section 114 of the US Copyright Act (or
+          the equivalent in other jurisdictions).</li>
+        </ol>
+
+        <p>The above rights may be exercised in all media and
+        formats whether now known or hereafter devised. The above
+        rights include the right to make such modifications as are
+        technically necessary to exercise the rights in other media
+        and formats. All rights not expressly granted by Licensor
+        are hereby reserved.</p>
+
+        <p><strong>4. Restrictions.</strong> The license granted in
+        Section 3 above is expressly made subject to and limited by
+        the following restrictions:</p>
+
+        <ol type="a">
+          <li>You may distribute, publicly display, publicly
+          perform, or publicly digitally perform the Work only
+          under the terms of this License, and You must include a
+          copy of, or the Uniform Resource Identifier for, this
+          License with every copy or phonorecord of the Work You
+          distribute, publicly display, publicly perform, or
+          publicly digitally perform. You may not offer or impose
+          any terms on the Work that restrict the terms of this
+          License or the ability of a recipient of the Work to
+          exercise of the rights granted to that recipient under
+          the terms of the License. You may not sublicense the
+          Work. You must keep intact all notices that refer to this
+          License and to the disclaimer of warranties. When You
+          distribute, publicly display, publicly perform, or
+          publicly digitally perform the Work, You may not impose
+          any technological measures on the Work that restrict the
+          ability of a recipient of the Work from You to exercise
+          of the rights granted to that recipient under the terms
+          of the License. This Section 4(a) applies to the Work as
+          incorporated in a Collective Work, but this does not
+          require the Collective Work apart from the Work itself to
+          be made subject to the terms of this License. If You
+          create a Collective Work, upon notice from any Licensor
+          You must, to the extent practicable, remove from the
+          Collective Work any credit as required by Section 4(c),
+          as requested. If You create a Derivative Work, upon
+          notice from any Licensor You must, to the extent
+          practicable, remove from the Derivative Work any credit
+          as required by Section 4(c), as requested.</li>
+
+          <li>You may distribute, publicly display, publicly
+          perform, or publicly digitally perform a Derivative Work
+          only under: (i) the terms of this License; (ii) a later
+          version of this License with the same License Elements as
+          this License; (iii) either the Creative Commons
+          (Unported) license or a Creative Commons jurisdiction
+          license (either this or a later license version) that
+          contains the same License Elements as this License (e.g.
+          Attribution-ShareAlike 3.0 (Unported)); (iv) a Creative
+          Commons Compatible License. If you license the Derivative
+          Work under one of the licenses mentioned in (iv), you
+          must comply with the terms of that license. If you
+          license the Derivative Work under the terms of any of the
+          licenses mentioned in (i), (ii) or (iii) (the "Applicable
+          License"), you must comply with the terms of the
+          Applicable License generally and with the following
+          provisions: (I) You must include a copy of, or the
+          Uniform Resource Identifier for, the Applicable License
+          with every copy or phonorecord of each Derivative Work
+          You distribute, publicly display, publicly perform, or
+          publicly digitally perform; (II) You may not offer or
+          impose any terms on the Derivative Works that restrict
+          the terms of the Applicable License or the ability of a
+          recipient of the Work to exercise the rights granted to
+          that recipient under the terms of the Applicable License;
+          (III) You must keep intact all notices that refer to the
+          Applicable License and to the disclaimer of warranties;
+          and, (IV) when You distribute, publicly display, publicly
+          perform, or publicly digitally perform the Work, You may
+          not impose any technological measures on the Derivative
+          Work that restrict the ability of a recipient of the
+          Derivative Work from You to exercise the rights granted
+          to that recipient under the terms of the Applicable
+          License. This Section 4(b) applies to the Derivative Work
+          as incorporated in a Collective Work, but this does not
+          require the Collective Work apart from the Derivative
+          Work itself to be made subject to the terms of the
+          Applicable License.</li>
+
+          <li>If You distribute, publicly display, publicly
+          perform, or publicly digitally perform the Work (as
+          defined in Section 1 above) or any Derivative Works (as
+          defined in Section 1 above) or Collective Works (as
+          defined in Section 1 above), You must, unless a request
+          has been made pursuant to Section 4(a), keep intact all
+          copyright notices for the Work and provide, reasonable to
+          the medium or means You are utilizing: (i) the name of
+          the Original Author (or pseudonym, if applicable) if
+          supplied, and/or (ii) if the Original Author and/or
+          Licensor designate another party or parties (e.g. a
+          sponsor institute, publishing entity, journal) for
+          attribution ("Attribution Parties") in Licensor's
+          copyright notice, terms of service or by other reasonable
+          means, the name of such party or parties; the title of
+          the Work if supplied; to the extent reasonably
+          practicable, the Uniform Resource Identifier, if any,
+          that Licensor specifies to be associated with the Work,
+          unless such URI does not refer to the copyright notice or
+          licensing information for the Work; and, consistent with
+          Section 3(b) in the case of a Derivative Work, a credit
+          identifying the use of the Work in the Derivative Work
+          (e.g., "French translation of the Work by Original
+          Author," or "Screenplay based on original Work by
+          Original Author"). The credit required by this Section
+          4(c) may be implemented in any reasonable manner;
+          provided, however, that in the case of a Derivative Work
+          or Collective Work, at a minimum such credit will appear,
+          if a credit for all contributing authors of the
+          Derivative Work or Collective Work appears, then as part
+          of these credits and in a manner at least as prominent as
+          the credits for the other contributing authors. For the
+          avoidance of doubt, You may only use the credit required
+          by this Section for the purpose of attribution in the
+          manner set out above and, by exercising Your rights under
+          this License, You may not implicitly or explicitly assert
+          or imply any connection with, sponsorship or endorsement
+          by the Original Author, Licensor and/or Attribution
+          Parties, as appropriate, of You or Your use of the Work,
+          without the separate, express prior written permission of
+          the Original Author, Licensor and/or Attribution
+          Parties.</li>
+        </ol>
+
+        <p><strong>5. Representations, Warranties and
+        Disclaimer</strong></p>
+
+        <p>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN
+        WRITING, LICENSOR OFFERS THE WORK AS-IS AND ONLY TO THE
+        EXTENT OF ANY RIGHTS HELD IN THE LICENSED WORK BY THE
+        LICENSOR. THE LICENSOR MAKES NO REPRESENTATIONS OR
+        WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS,
+        IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
+        LIMITATION, WARRANTIES OF TITLE, MARKETABILITY,
+        MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE,
+        NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
+        ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR
+        NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
+        EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT
+        APPLY TO YOU.</p>
+
+        <p><strong>6. Limitation on Liability.</strong> EXCEPT TO
+        THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
+        LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY
+        SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY
+        DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK,
+        EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF
+        SUCH DAMAGES.</p>
+
+        <p><strong>7. Termination</strong></p>
+
+        <ol type="a">
+          <li>This License and the rights granted hereunder will
+          terminate automatically upon any breach by You of the
+          terms of this License. Individuals or entities who have
+          received Derivative Works or Collective Works from You
+          under this License, however, will not have their licenses
+          terminated provided such individuals or entities remain
+          in full compliance with those licenses. Sections 1, 2, 5,
+          6, 7, and 8 will survive any termination of this
+          License.</li>
+
+          <li>Subject to the above terms and conditions, the
+          license granted here is perpetual (for the duration of
+          the applicable copyright in the Work). Notwithstanding
+          the above, Licensor reserves the right to release the
+          Work under different license terms or to stop
+          distributing the Work at any time; provided, however that
+          any such election will not serve to withdraw this License
+          (or any other license that has been, or is required to
+          be, granted under the terms of this License), and this
+          License will continue in full force and effect unless
+          terminated as stated above.</li>
+        </ol>
+
+        <p><strong>8. Miscellaneous</strong></p>
+
+        <ol type="a">
+          <li>Each time You distribute or publicly digitally
+          perform the Work (as defined in Section 1 above) or a
+          Collective Work (as defined in Section 1 above), the
+          Licensor offers to the recipient a license to the Work on
+          the same terms and conditions as the license granted to
+          You under this License.</li>
+
+          <li>Each time You distribute or publicly digitally
+          perform a Derivative Work, Licensor offers to the
+          recipient a license to the original Work on the same
+          terms and conditions as the license granted to You under
+          this License.</li>
+
+          <li>If any provision of this License is invalid or
+          unenforceable under applicable law, it shall not affect
+          the validity or enforceability of the remainder of the
+          terms of this License, and without further action by the
+          parties to this agreement, such provision shall be
+          reformed to the minimum extent necessary to make such
+          provision valid and enforceable.</li>
+
+          <li>No term or provision of this License shall be deemed
+          waived and no breach consented to unless such waiver or
+          consent shall be in writing and signed by the party to be
+          charged with such waiver or consent.</li>
+
+          <li>This License constitutes the entire agreement between
+          the parties with respect to the Work licensed here. There
+          are no understandings, agreements or representations with
+          respect to the Work not specified here. Licensor shall
+          not be bound by any additional provisions that may appear
+          in any communication from You. This License may not be
+          modified without the mutual written agreement of the
+          Licensor and You.</li>
+        </ol>
+        <!-- BREAKOUT FOR CC NOTICE.  NOT A PART OF THE LICENSE -->
+
+        <blockquote>
+          <h3>Creative Commons Notice</h3>
+
+          <p>Creative Commons is not a party to this License, and
+          makes no warranty whatsoever in connection with the Work.
+          Creative Commons will not be liable to You or any party
+          on any legal theory for any damages whatsoever, including
+          without limitation any general, special, incidental or
+          consequential damages arising in connection to this
+          license. Notwithstanding the foregoing two (2) sentences,
+          if Creative Commons has expressly identified itself as
+          the Licensor hereunder, it shall have all rights and
+          obligations of Licensor.</p>
+
+          <p>Except for the limited purpose of indicating to the
+          public that the Work is licensed under the CCPL, Creative
+          Commons does not authorize the use by either party of the
+          trademark "Creative Commons" or any related trademark or
+          logo of Creative Commons without the prior written
+          consent of Creative Commons. Any permitted use will be in
+          compliance with Creative Commons' then-current trademark
+          usage guidelines, as may be published on its website or
+          otherwise made available upon request from time to time.
+          For the avoidance of doubt, this trademark restriction
+          does not form part of this License.</p>
+
+          <p>Creative Commons may be contacted at <a href=
+          "http://creativecommons.org/">http://creativecommons.org/</a>.</p>
+        </blockquote>
+      </div>
+    </div>
+
+  </div>
diff --git a/doc/user/copying/copying.html.textile.liquid b/doc/user/copying/copying.html.textile.liquid
new file mode 100644 (file)
index 0000000..2ab8681
--- /dev/null
@@ -0,0 +1,11 @@
+---
+layout: default
+navsection: userguide
+title: "Arvados Free Software Licenses"
+...
+
+Server-side components of Arvados contained in the apps/ and services/ directories, including the API Server, Workbench, and Crunch, are licenced under the "GNU Affero General Public License version 3":agpl-3.0.html.
+
+The Arvados client Software Development Kits contained in the sdk/ directory, example scripts in the crunch_scripts/ directory, and code samples in the Aravados documentation are licensed under the "Apache License, Version 2.0":LICENSE-2.0.html
+
+The Arvados Documentation located in the doc/ directory is licensed under the "Creative Commons Attribution-Share Alike 3.0 United States":by-sa-3.0.html
index b657a68c9f042926e94f6f5e63889d51aadf3906..13bb1ae0867482844e9c2dbea7bb81fe3b9b1a22 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Examples
 title: "Crunch examples"
-
 ...
 
-h1. Crunch examples
-
 Several crunch scripts are included with Arvados in the "/crunch_scripts directory":https://arvados.org/projects/arvados/repository/revisions/master/show/crunch_scripts. They are intended to provide examples and starting points for writing your own scripts.
 
 h4. bwa-aln
index 6cf35f340a662bf2816d2e912f81d78c64bc3706..2908e6e7422373bbc18d44c58551bd98b122e82b 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Getting Started
 title: "Checking your environment"
-
 ...
 
-h1. Checking your environment
-
 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:
@@ -42,5 +38,3 @@ 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.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.baseurl}}/user/tutorials/tutorial-keep.html
index c910ac1f42b404fe09370f359c3bedf7f6be09c5..8b6e22d1fd3effb7091c0244d5a1572a61a5be4d 100644 (file)
@@ -1,12 +1,8 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Getting Started
 title: Arvados Community and Getting Help
-
 ...
-h1. Arvados Community and Getting Help
-
 
 h2. On the web
 
index 3c40315ad7a9a010f3479a03ffcbabc37ae742bb..e4a2b9c8b9da8d4e083918f051159a7cf32e7296 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Getting Started
 title: Accessing an Arvados VM over ssh
-
 ...
 
-h1. Accessing an Arvados Virtual Machine over ssh
-
 Arvados requires a public @ssh@ key in order to securely log in to an Arvados VM instance, or to access an Arvados @git@ repository.
 
 This document is divided up into three sections.
@@ -133,7 +129,7 @@ h1(#workbench). Adding your key to Arvados Workbench
 
 h3. From the workbench dashboard
 
-If you have no @ssh@ keys registered, there should be a notification asking you to provide your @ssh@ public key.  On the Workbench dashboard (in this guide, this is "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/ ), look for the envelope icon <span class="glyphicon glyphicon-envelope"></span> <span class="badge badge-alert">1</span> in upper right corner (the number indicates there are new notifications).  Click on this icon and a dropdown menu should appear with a message asking you to add your public key.  Paste your public key into the text area provided and click on the check button to submit the key.  You are now ready to "log into an Arvados VM":#login.
+If you have no @ssh@ keys registered, there should be a notification asking you to provide your @ssh@ public key.  On the Workbench dashboard (in this guide, this is "https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/ ), look for the envelope icon <span class="glyphicon glyphicon-envelope"></span> <span class="badge badge-alert">1</span> in upper right corner (the number indicates there are new notifications).  Click on this icon and a dropdown menu should appear with a message asking you to add your public key.  Paste your public key into the text area provided and click on the check button to submit the key.  You are now ready to "log into an Arvados VM":#login.
 
 h3. Alternate way to add ssh keys
 
@@ -184,6 +180,7 @@ Since the above command line is cumbersome, it can be greatly simplfied by addin
 <notextile>
 <pre><code class="userinput">Host *.arvados
   ProxyCommand ssh -a -x -p2222 turnout@switchyard.{{ site.arvados_api_host }} $SSH_PROXY_FLAGS %h
+  User <b>you</b>
   ForwardAgent yes
   ForwardX11 no
 </code></pre>
@@ -191,7 +188,7 @@ Since the above command line is cumbersome, it can be greatly simplfied by addin
 
 This will recognize any host ending in ".arvados" and automatically apply the proxy, user and forwarding settings from the configuration file, allowing you to log in with a much simpler command:
 
-notextile. <pre><code>$ <span class="userinput">ssh <b>you@shell</b>.arvados</span></code></pre>
+notextile. <pre><code>$ <span class="userinput">ssh <b>shell</b>.arvados</span></code></pre>
 
 h2(#windowsvm). Logging in using PuTTY (Windows)
 
index 71041b3ea2c7d46cf52d5bb6ce90ff74fb926ad9..48a4c470b8604524547b3f1f162479c3c433c23e 100644 (file)
@@ -1,18 +1,13 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Getting Started
 title: Accessing Arvados Workbench
-
 ...
-h1. Accessing Arvados Workbench
 
 Access the Arvados beta test instance available using this link:
 
-"https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/
+"https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/
 
 If you are accessing Arvados for the first time, you will be asked to log in using a Google account.  Arvados uses only your name and email address from Google services for identification, and will never access any personal information.  Once you are logged in, the Workbench page may indicate your account status is *New / inactive*.  If this is the case, contact the administrator of the Arvados instance to activate your account.
 
 Once your account is active, logging in to the Workbench will present you with a system status dashboard.  This gives a summary of data, configuration, and activity in the Arvados instance.
-
-Next, we will "configure your account for ssh access to an Arvados virtual machine (VM).":ssh-access.html
index 982b1c3fc3378dc741ecb3045036740d927b082c..03a9e602391076e73dee2f2987062b529ec52869 100644 (file)
@@ -2,12 +2,9 @@
 layout: default
 navsection: userguide
 title: Welcome to Arvados!
-
 ...
 
-h1. Welcome to Arvados!
-
-This guide is intended to introduce new users to the Arvados system.  It covers initial configuration required to use the system and then presents several tutorials on using Arvados to do data processing.
+This guide is intended to introduce new users to the Arvados system.  It covers initial configuration required to access the system and then presents several tutorials on using Arvados to do data processing.
 
 This user guide introduces how to use the major components of Arvados.  These are:
 
@@ -26,9 +23,11 @@ To get the most value out of this guide, you should be comfortable with the foll
 # Programming in @python@
 # Revision control using @git@
 
-The examples in this guide uses the public Arvados instance located at "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/ .  You must have an account in order to use this service.  If you would like to request an account, please send an email to "arvados@curoverse.com":mailto:arvados@curoverse.com .
+We also recommend you read the "Arvados Platform Overview":https://arvados.org/projects/arvados/wiki#Platform-Overview for an introduction and background information about Arvados.
+
+The examples in this guide uses the Arvados instance located at "https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/ .  If you are using a different Arvados instance replace @{{ site.arvados_workbench_host }}@ with your private instance in all of the examples in this guide.
 
-If you are using a different Arvados instance replace @{{ site.arvados_api_host }}@ with your private instance in all of the examples in this guide.
+The Arvados public beta instance is located at "https://workbench.qr1hi.arvadosapi.com/":https://workbench.qr1hi.arvadosapi.com/ .  You must have an account in order to use this service.  If you would like to request an account, please send an email to "arvados@curoverse.com":mailto:arvados@curoverse.com .
 
 h2. Typographic conventions
 
@@ -36,11 +35,11 @@ This manual uses the following typographic conventions:
 
 <notextile>
 <ul>
-<li>Code blocks which are set aside from the text indicate user input to the system.  Commands that should be entered into a Unix shell are indicated by the directory where you should  enter the command ('~' indicates your home directory) followed by '$', followed by the highlighted <span class="userinput">command to enter</span> (do not enter the '$'), and possibly followed by example command output in black.  For example, the following block indicates that you should type "ls foo" while in your home directory and the expected output will be "foo".
-
+<li>Code blocks which are set aside from the text indicate user input to the system.  Commands that should be entered into a Unix shell are indicated by the directory where you should  enter the command ('~' indicates your home directory) followed by '$', followed by the highlighted <span class="userinput">command to enter</span> (do not enter the '$'), and possibly followed by example command output in black.  For example, the following block indicates that you should type "ls foo.*" while in your home directory and the expected output will be "foo.input" and "foo.output".
 <pre><code>~$ <span class="userinput">ls foo</span>
 foo
-</code></pre></li>
+</code></pre>
+</li>
 
 <li>Code blocks inline with text emphasize specific <code>programs</code>, <code>files</code>, or <code>options</code> that are being discussed.</li>
 <li>Bold text emphasizes <b>specific items</b> to look when discussing Arvados Workbench pages.</li>
@@ -49,4 +48,3 @@ foo
 </ul>
 </notextile>
 
-Now begin by "accessing the Arvados workbench.":getting_started/workbench.html
index d47c1ccdae42436b8c5bd8b55345a81e26875658..018c71c6781d524255557b9d11449875ea867810 100644 (file)
@@ -1,16 +1,12 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Reference
 title: "Getting an API token"
-
 ...
 
-h1. Reference: Getting an API token
-
 The Arvados API token is a secret key that enables the @arv@ command line client to access Arvados with the proper permissions.
 
-Access the Arvados workbench using this link: "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/
+Access the Arvados workbench using this link: "https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/
 
 (Replace @{{ site.arvados_api_host }}@ with the hostname of your local Arvados instance if necessary.)
 
index c79563161c4d60722b3040029fec5ef931dd8269..f44fef2bf48617107148b75cc713d281a2d1dfda 100644 (file)
@@ -1,12 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Reference
 title: "Command line interface"
 ...
 
-h1. Reference: Command Line Interface
-
 *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
diff --git a/doc/user/topics/keep.html.textile.liquid b/doc/user/topics/keep.html.textile.liquid
new file mode 100644 (file)
index 0000000..dae133a
--- /dev/null
@@ -0,0 +1,48 @@
+---
+layout: default
+navsection: userguide
+title: "How Keep works"
+...
+
+In Keep, information is stored in *data blocks*.  Data blocks are normally between 1 byte and 64 megabytes in size.  If a file exceeds the maximum size of a single data block, the file will be split across multiple data blocks until the entire file can be stored.  These data blocks may be stored and replicated across multiple disks, servers, or clusters.  Each data block has its own identifier for the contents of that specific data block.
+
+In order to reassemble the file, Keep stores a *collection* data block which lists in sequence the data blocks that make up the original file.  A collection data block may store the information for multiple files, including a directory structure.
+
+In this example we will use @c1bad4b39ca5a924e481008009d94e32+210@ which we added to Keep in "the first Keep tutorial":{{ site.baseurl }}/users/tutorial/tutorial-keep.html.  First let us examine the contents of this collection using @arv keep get@:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv keep get c1bad4b39ca5a924e481008009d94e32+210</span>
+. 204e43b8a1185621ca55a94839582e6f+67108864 b9677abbac956bd3e86b1deb28dfac03+67108864 fc15aff2a762b13f521baf042140acec+67108864 323d2a3ce20370c4ca1d3462a344f8fd+25885655 0:227212247:var-GS000016015-ASM.tsv.bz2
+</code></pre>
+</notextile>
+
+The command @arv keep get@ fetches the contents of the locator @c1bad4b39ca5a924e481008009d94e32+210@.  This is a locator for a collection data block, so it fetches the contents of the collection.  In this example, this collection consists of a single file @var-GS000016015-ASM.tsv.bz2@ which is 227212247 bytes long, and is stored using four sequential data blocks, <code>204e43b8a1185621ca55a94839582e6f+67108864</code>, <code>b9677abbac956bd3e86b1deb28dfac03+67108864</code>, <code>fc15aff2a762b13f521baf042140acec+67108864</code>, <code>323d2a3ce20370c4ca1d3462a344f8fd+25885655</code>.
+
+Let's use @arv keep get@ to download the first datablock:
+
+notextile. <pre><code>~$ <span class="userinput">cd /scratch/<b>you</b></span>
+/scratch/<b>you</b>$ <span class="userinput">arv keep get 204e43b8a1185621ca55a94839582e6f+67108864 &gt; block1</span></code></pre>
+
+{% include 'notebox_begin' %}
+
+When you run this command, you may get this API warning:
+
+notextile. <pre><code>WARNING:root:API lookup failed for collection 204e43b8a1185621ca55a94839582e6f+67108864 (&lt;class 'apiclient.errors.HttpError'&gt;: &lt;HttpError 404 when requesting https://qr1hi.arvadosapi.com/arvados/v1/collections/204e43b8a1185621ca55a94839582e6f%2B67108864?alt=json returned "Not Found"&gt;)</code></pre>
+
+This happens because @arv keep get@ tries to find a collection with this identifier.  When that fails, it emits this warning, then looks for a datablock instead, which succeeds.
+
+{% include 'notebox_end' %}
+
+Let's look at the size and compute the md5 hash of @block1@:
+
+<notextile>
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">ls -l block1</span>
+-rw-r--r-- 1 you group 67108864 Dec  9 20:14 block1
+/scratch/<b>you</b>$ <span class="userinput">md5sum block1</span>
+204e43b8a1185621ca55a94839582e6f  block1
+</code></pre>
+</notextile>
+
+Notice that the block identifer <code>204e43b8a1185621ca55a94839582e6f+67108864</code> consists of:
+* the md5 hash @204e43b8a1185621ca55a94839582e6f@ which matches the md5 hash of @block1@
+* a size hint @67108864@ which matches the size of @block1@
diff --git a/doc/user/topics/running-pipeline-command-line.html.textile.liquid b/doc/user/topics/running-pipeline-command-line.html.textile.liquid
new file mode 100644 (file)
index 0000000..1b8550f
--- /dev/null
@@ -0,0 +1,119 @@
+---
+layout: default
+navsection: userguide
+title: "Running a pipeline on the command line"
+...
+
+In "Writing a pipeline":{{ site.baseurl }}/user/tutorials/tutorial-firstscript.html, we learned how to create a pipeline template on the command-line.  Let's create one that doesn't require any user input to start:
+
+<notextile>
+<pre><code>~$ <span class="userinput">cat &gt;the_pipeline &lt;&lt;EOF
+{
+  "name":"Filter md5 hash values",
+  "components":{
+    "do_hash":{
+      "script":"hash.py",
+      "script_parameters":{
+        "input": "887cd41e9c613463eab2f0d885c6dd96+83"
+      },
+      "script_version":"<b>you</b>:master"
+    },
+    "filter":{
+      "script":"0-filter.py",
+      "script_parameters":{
+        "input":{
+          "output_of":"do_hash"
+        }
+      },
+      "script_version":"<b>you</b>:master"
+    }
+  }
+}
+EOF</span>
+~$ <span class="userinput">arv pipeline_template create --pipeline-template "$(cat the_pipeline)"</span></code></pre>
+</notextile>
+
+You can run this pipeline from the command line using @arv pipeline run@, filling in the UUID that you received from @arv pipeline_template create@:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv pipeline run --template qr1hi-p5p6p-xxxxxxxxxxxxxxx</span>
+2013-12-16 14:08:40 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
+do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 queued 2013-12-16T14:08:40Z
+filter  -                           -
+
+2013-12-16 14:08:51 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
+do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 8e1b6acdd3f2f1da722538127c5c6202+56
+filter  qr1hi-8i9sb-w5k40fztqgg9i2x queued 2013-12-16T14:08:50Z
+
+2013-12-16 14:09:01 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
+do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 8e1b6acdd3f2f1da722538127c5c6202+56
+filter  qr1hi-8i9sb-w5k40fztqgg9i2x 735ac35adf430126cf836547731f3af6+56
+</code></pre>
+</notextile>
+
+This instantiates your pipeline and displays a live feed of its status.  The new pipeline instance will also show up on the Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;instances page.
+
+Arvados adds each pipeline component to the job queue as its dependencies are satisfied (or immediately if it has no dependencies) and finishes when all components are completed or failed and there is no more work left to do.
+
+The Keep locators of the output of each of @"do_hash"@ and @"filter"@ component are available from the output log shown above.  The output is also available on the Workbench by navigating to %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;instances %(rarr)&rarr;% pipeline uuid under the *id* column %(rarr)&rarr;% components.
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv keep get 8e1b6acdd3f2f1da722538127c5c6202+56/md5sum.txt</span>
+0f1d6bcf55c34bed7f92a805d2d89bbf alice.txt
+504938460ef369cd275e4ef58994cffe bob.txt
+8f3b36aff310e06f3c5b9e95678ff77a carol.txt
+~$ <span class="userinput">arv keep get 735ac35adf430126cf836547731f3af6+56/0-filter.txt</span>
+0f1d6bcf55c34bed7f92a805d2d89bbf alice.txt
+</code></pre>
+</notextile>
+
+Indeed, the filter has picked out just the "alice" file as having a hash that starts with 0.
+
+h3. Running a pipeline with different parameters
+
+Notice that the pipeline template explicitly specifies the Keep locator for the input:
+
+<notextile>
+<pre><code>...
+    "do_hash":{
+      "script_parameters":{
+        "input": "887cd41e9c613463eab2f0d885c6dd96+83"
+      },
+    }
+...
+</code></pre>
+</notextile>
+
+You can specify values for pipeline component script_parameters like this:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv pipeline run --template qr1hi-p5p6p-xxxxxxxxxxxxxxx do_hash::input=c1bad4b39ca5a924e481008009d94e32+210</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  -                           -
+
+2013-12-17 20:31:34 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
+do_hash qr1hi-8i9sb-rffhuay4jryl2n2 {:done=>1, :running=>1, :failed=>0, :todo=>0}
+filter  -                           -
+
+2013-12-17 20:31:55 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
+do_hash qr1hi-8i9sb-rffhuay4jryl2n2 880b55fb4470b148a447ff38cacdd952+54
+filter  qr1hi-8i9sb-j347g1sqovdh0op queued 2013-12-17T20:31:55Z
+
+2013-12-17 20:32:05 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
+do_hash qr1hi-8i9sb-rffhuay4jryl2n2 880b55fb4470b148a447ff38cacdd952+54
+filter  qr1hi-8i9sb-j347g1sqovdh0op 490cd451c8108824b8a17e3723e1f236+19
+</code></pre>
+</notextile>
+
+Now check the output:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv keep get 880b55fb4470b148a447ff38cacdd952+54/md5sum.txt</span>
+44b8ae3fde7a8a88d2f7ebd237625b4f var-GS000016015-ASM.tsv.bz2
+~$ <span class="userinput">arv keep get 490cd451c8108824b8a17e3723e1f236+19/0-filter.txt</span>
+~$
+</code></pre>
+</notextile>
+
+Since none of the files in the collection have hash code that start with 0, output of the filter component is empty.
similarity index 98%
rename from doc/user/tutorials/tutorial-gatk-variantfiltration.html.textile.liquid
rename to doc/user/topics/tutorial-gatk-variantfiltration.html.textile.liquid
index 3bf05a5dbd9903a4410c5a56339d9da6ea32d82c..f83c19934a56afb70a3dada213c6bf2fc939ecf4 100644 (file)
@@ -1,20 +1,16 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
 title: "Using GATK with Arvados"
-
 ...
 
-h1. Using GATK with Arvados
-
 This tutorial 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.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
 
 h2. Installing GATK
 
-Download the GATK binary tarball[1] -- e.g., @GenomeAnalysisTK-2.6-4.tar.bz2@ -- and "copy it to your Arvados VM":tutorial-keep.html.
+Download the GATK binary tarball[1] -- e.g., @GenomeAnalysisTK-2.6-4.tar.bz2@ -- and "copy it to your Arvados VM":{{site.baseurl}}/user/tutorials/tutorial-keep.html.
 
 <notextile>
 <pre><code>~$ <span class="userinput">arv keep put GenomeAnalysisTK-2.6-4.tar.bz2</span>
similarity index 95%
rename from doc/user/tutorials/tutorial-job-debug.html.textile.liquid
rename to doc/user/topics/tutorial-job-debug.html.textile.liquid
index 28052089b389829368d511df44f00430ffa041f5..0974e51697031449259f89221e4a0dc18e81658c 100644 (file)
@@ -1,18 +1,14 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
 title: "Debugging a Crunch script"
-
 ...
 
-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.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.
+This tutorial uses *@you@* to denote your username.  Replace *@you@* with your user name in all the following examples.
 
 h2. Create a new script
 
@@ -37,7 +33,7 @@ Instead of a git commit hash, we provide the path to the directory in the "scrip
 <pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_job &lt;&lt;EOF
 {
  "script":"hello-world.py",
- "script_version":"/home/you/you",
+ "script_version":"/home/<b>you</b>/<b>you</b>",
  "script_parameters":{}
 }
 EOF</span>
@@ -46,7 +42,7 @@ EOF</span>
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  node localhost - 1 slots
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  start
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  script hello-world.py
-2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  script_version /home/you/you
+2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  script_version /home/<b>you</b>/<b>you</b>
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  script_parameters {}
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  runtime_constraints {"max_tasks_per_node":0}
 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827  start level 0
@@ -75,7 +71,7 @@ bc. 2013-12-12_21:36:42 qr1hi-8i9sb-okzukfzkpbrnhst 29827 0 stderr hello world
 The script's output is captured in the log, which is useful for print statement debugging. However, although this script returned a status code of 0 (success), the job failed.  Why?  For a job to complete successfully scripts must explicitly add their output to Keep, and then tell Arvados about it.  Here is a second try:
 
 <notextile>
-<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;hello-world.py &lt;&lt;EOF
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;hello-world-fixed.py &lt;&lt;EOF
 #!/usr/bin/env python
 
 import arvados
@@ -101,7 +97,7 @@ EOF</span>
 ~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_job &lt;&lt;EOF
 {
  "script":"hello-world-fixed.py",
- "script_version":"/home/you/you",
+ "script_version":"/home/<b>you</b>/<b>you</b>",
  "script_parameters":{}
 }
 EOF</span>
@@ -110,7 +106,7 @@ EOF</span>
 2013-12-12_21:56:59 qr1hi-8i9sb-79260ykfew5trzl 31578  node localhost - 1 slots
 2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  start
 2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  script hello-world.py
-2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  script_version /home/you/you
+2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  script_version /home/<b>you</b>/<b>you</b>
 2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  script_parameters {}
 2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  runtime_constraints {"max_tasks_per_node":0}
 2013-12-12_21:57:00 qr1hi-8i9sb-79260ykfew5trzl 31578  start level 0
@@ -153,4 +149,3 @@ Read and write data to @/tmp/@ instead of Keep. This only works with the Python
 
 notextile. <pre><code>~$ <span class="userinput">export KEEP_LOCAL_STORE=/tmp</span></code></pre>
 
-Next, "parallel tasks.":tutorial-parallel.html
similarity index 74%
rename from doc/user/tutorials/tutorial-job1.html.textile.liquid
rename to doc/user/topics/tutorial-job1.html.textile.liquid
index a0dd8960335f2a57b2466f9c7a34c227b712ddde..61eaa639a62f7cb34662ae41a86bac9f10d2d4b9 100644 (file)
@@ -1,32 +1,20 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
-title: "Running a Crunch job"
-
+title: "Running a Crunch job on the command line"
 ...
 
-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 introduces how to run individual Crunch jobs using the @arv@ command line tool.
 
 *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.
-* Very large files may exceed the scratch space of the local disk.
-* We are only able to use the local CPU to process the file.
+You will create a job to run the "hash" crunch script.  The "hash" script computes the md5 hash of each file in a collection.
 
-The Arvados "Crunch" framework is designed to support processing very large data batches (gigabytes to terabytes) efficiently, and provides the following benefits:
-* Increase concurrency by running tasks asynchronously, using many CPUs and network interfaces at once (especially beneficial for CPU-bound and I/O-bound tasks respectively).
-* Track inputs, outputs, and settings so you can verify that the inputs, settings, and sequence of programs you used to arrive at an output is really what you think it was.
-* Ensure that your programs and workflows are repeatable with different versions of your code, OS updates, etc.
-* Interrupt and resume long-running jobs consisting of many short tasks.
-* Maintain timing statistics automatically, so they're there when you want them.
+h2. Jobs
 
-For your first job, you will run the "hash" crunch script using the Arvados system.  The "hash" script computes the md5 hash of each file in a collection.
+Crunch pipelines consist of one or more jobs.  A "job" is a single run of a specific version of a crunch script with a specific input.  You an also run jobs individually.
 
-Crunch jobs are described using JSON objects.  For example:
+A request to run a crunch job are is described using a JSON object.  For example:
 
 <notextile>
 <pre><code>~$ <span class="userinput">cat &gt;the_job &lt;&lt;EOF
@@ -46,7 +34,7 @@ EOF
 * @<<EOF@ tells the shell to direct the following lines into the standard input for @cat@ up until it sees the line @EOF@
 * @>the_job@ redirects standard output to a file called @the_job@
 * @"script"@ specifies the name of the script to run.  The script is searched for in the "crunch_scripts/" subdirectory of the @git@ checkout specified by @"script_version"@.
-* @"script_version"@ specifies the version of the script that you wish to run.  This can be in the form of an explicit @git@ revision hash, or in the form "repository:branch" (in which case it will take the HEAD of the specified branch).  Arvados logs the script version that was used in the run, enabling you to go back and re-run any past job with the guarantee that the exact same code will be used as was used in the previous run.  You can access a list of available @git@ repositories on the Arvados workbench under _Compute %(rarr)&rarr;% Code repositories_.
+* @"script_version"@ specifies the version of the script that you wish to run.  This can be in the form of an explicit @git@ revision hash, or in the form "repository:branch" (in which case it will take the HEAD of the specified branch).  Arvados logs the script version that was used in the run, enabling you to go back and re-run any past job with the guarantee that the exact same code will be used as was used in the previous run.  You can access a list of available @git@ repositories on the Arvados workbench under "Compute %(rarr)&rarr;% Code repositories":http://{{site.arvados_workbench_host}}/repositories .
 * @"script_parameters"@ are provided to the script.  In this case, the input is the locator for the collection that we inspected in the previous section.
 
 Use @arv job create@ to actually submit the job.  It should print out a JSON object which describes the newly created job:
@@ -98,7 +86,7 @@ The job is now queued and will start running as soon as it reaches the front of
 
 h2. Monitor job progress
 
-Go to the Workbench dashboard.  Your job should be at the top of the "Recent jobs" table.  This table refreshes automatically.  When the job has completed successfully, it will show <span class="label label-success">finished</span> in the *Status* column.
+Go to the "Workbench dashboard":http://{{site.arvados_workbench_host}}.  Your job should be at the top of the "Recent jobs" table.  This table refreshes automatically.  When the job has completed successfully, it will show <span class="label label-success">finished</span> in the *Status* column.
 
 On the command line, you can access log messages while the job runs using @arv job log_tail_follow@:
 
@@ -108,7 +96,7 @@ This will print out the last several lines of the log for that job.
 
 h2. Inspect the job output
 
-On the workbench dashboard, look for the *Output* column of the *Recent jobs* table.  Click on the link under *Output* for your job to go to the files page with the job output.  The files page lists all the files that were output by the job.  Click on the link under the *files* column to view a file, or click on the download icon <span class="glyphicon glyphicon-download-alt"></span> to download the output file.
+On the "Workbench dashboard":http://{{site.arvados_workbench_host}}, look for the *Output* column of the *Recent jobs* table.  Click on the link under *Output* for your job to go to the files page with the job output.  The files page lists all the files that were output by the job.  Click on the link under the *files* column to view a file, or click on the download icon <span class="glyphicon glyphicon-download-alt"></span> to download the output file.
 
 On the command line, you can use @arv job get@ to access a JSON object describing the output:
 
@@ -137,7 +125,7 @@ On the command line, you can use @arv job get@ to access a JSON object describin
  "cancelled_by_user_uuid":null,
  "started_at":"2013-12-16T20:44:36Z",
  "finished_at":"2013-12-16T20:44:53Z",
- "output":"880b55fb4470b148a447ff38cacdd952+54",
+ "output":"dd755dbc8d49a67f4fe7dc843e4f10a6+54",
  "success":true,
  "running":false,
  "is_locked_by_uuid":"qr1hi-tpzed-9zdpkpni2yddge6",
@@ -157,12 +145,12 @@ On the command line, you can use @arv job get@ to access a JSON object describin
 </code></pre>
 </notextile>
 
-* @"output"@ is the unique identifier for this specific job's output.  This is a Keep collection.  Because the output of Arvados jobs should be deterministic, the known expected output is <code>880b55fb4470b148a447ff38cacdd952+54</code>.
+* @"output"@ is the unique identifier for this specific job's output.  This is a Keep collection.  Because the output of Arvados jobs should be deterministic, the known expected output is <code>dd755dbc8d49a67f4fe7dc843e4f10a6+54</code>.
 
 Now you can list the files in the collection:
 
 <notextile>
-<pre><code>~$ <span class="userinput">arv keep ls 880b55fb4470b148a447ff38cacdd952+54</span>
+<pre><code>~$ <span class="userinput">arv keep ls dd755dbc8d49a67f4fe7dc843e4f10a6+54</span>
 md5sum.txt
 </code></pre>
 </notextile>
@@ -170,8 +158,8 @@ md5sum.txt
 This collection consists of the @md5sum.txt@ file.  Use @arv keep get@ to show the contents of the @md5sum.txt@ file:
 
 <notextile>
-<pre><code>~$ <span class="userinput">arv keep get 880b55fb4470b148a447ff38cacdd952+54/md5sum.txt</span>
-44b8ae3fde7a8a88d2f7ebd237625b4f var-GS000016015-ASM.tsv.bz2
+<pre><code>~$ <span class="userinput">arv keep get dd755dbc8d49a67f4fe7dc843e4f10a6+54/md5sum.txt</span>
+44b8ae3fde7a8a88d2f7ebd237625b4f ./var-GS000016015-ASM.tsv.bz2
 </code></pre>
 </notextile>
 
@@ -221,15 +209,13 @@ The log collection consists of one log file named with the job id.  You can acce
 2013-12-16_20:44:39 qr1hi-8i9sb-1pm1t02dezhupss 7575  status: 1 done, 1 running, 0 todo
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575 1 child 7716 on compute13.1 exit 0 signal 0 success=true
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575 1 success in 13 seconds
-2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575 1 output 880b55fb4470b148a447ff38cacdd952+54
+2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575 1 output dd755dbc8d49a67f4fe7dc843e4f10a6+54
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575  wait for last 0 children to finish
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575  status: 2 done, 0 running, 0 todo
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575  release job allocation
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575  Freeze not implemented
 2013-12-16_20:44:52 qr1hi-8i9sb-1pm1t02dezhupss 7575  collate
-2013-12-16_20:44:53 qr1hi-8i9sb-1pm1t02dezhupss 7575  output 880b55fb4470b148a447ff38cacdd952+54
+2013-12-16_20:44:53 qr1hi-8i9sb-1pm1t02dezhupss 7575  output dd755dbc8d49a67f4fe7dc843e4f10a6+54+K@qr1hi
 2013-12-16_20:44:53 qr1hi-8i9sb-1pm1t02dezhupss 7575  finish
 </code></pre>
 </notextile>
-
-This concludes the first tutorial.  In the next tutorial, we will "write a script to compute the hash.":tutorial-firstscript.html
similarity index 71%
rename from doc/user/tutorials/tutorial-parallel.html.textile.liquid
rename to doc/user/topics/tutorial-parallel.html.textile.liquid
index be78506f5db5cad5aa4459af88426fcaff56e039..9d08b6988bbe6bb99d49a0f798aa31958cd5b24a 100644 (file)
@@ -1,14 +1,10 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
 title: "Parallel Crunch tasks"
-
 ...
 
-h1. Parallel Crunch tasks
-
-In the tutorial "writing a crunch script,":tutorial-firstscript.html our script used a "for" loop to compute the md5 hashes for each file in sequence.  This approach, while simple, is not able to take advantage of the compute cluster with multiple nodes and cores to speed up computation by running tasks in parallel.  This tutorial will demonstrate how to create parallel Crunch tasks.
+In the previous tutorials, we used @arvados.job_setup.one_task_per_input_file()@ to automatically parallelize our jobs by creating a separate task per file.  For some types of jobs, you may need to split the work up differently, for example creating tasks to process different segments of a single large file.  In this this tutorial will demonstrate how to create Crunch tasks directly.
 
 Start by entering the @crunch_scripts@ directory of your git repository:
 
@@ -23,7 +19,7 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano parall
 
 Add the following code to compute the md5 hash of each file in a 
 
-<pre><code class="userinput">{% include 'parallel_hash_script_py' %}</code></pre>
+<notextile> {% code 'parallel_hash_script_py' as python %} </notextile>
 
 Make the file executable:
 
@@ -38,13 +34,13 @@ Next, add the file to @git@ staging, commit and push:
 </code></pre>
 </notextile>
 
-You should now be able to run your new script using Crunch, with "script" referring to our new "parallel-hash.py" script.  We will use a different input from our previous examples.  We will use @887cd41e9c613463eab2f0d885c6dd96+83@ which consists of three files, "alice.txt", "bob.txt" and "carol.txt" (the example collection used previously in "fetching data from Arvados using Keep":tutorial-keep.html).
+You should now be able to run your new script using Crunch, with "script" referring to our new "parallel-hash.py" script.  We will use a different input from our previous examples.  We will use @887cd41e9c613463eab2f0d885c6dd96+83@ which consists of three files, "alice.txt", "bob.txt" and "carol.txt" (the example collection used previously in "fetching data from Arvados using Keep":{{site.baseurl}}/user/tutorials/tutorial-keep.html#dir).
 
 <notextile>
 <pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_job &lt;&lt;EOF
 {
  "script": "parallel-hash.py",
- "script_version": "you:master",
+ "script_version": "<b>you</b>:master",
  "script_parameters":
  {
   "input": "887cd41e9c613463eab2f0d885c6dd96+83"
@@ -69,7 +65,7 @@ EOF</span>
 Because the job ran in parallel, each instance of parallel-hash creates a separate @md5sum.txt@ as output.  Arvados automatically collates theses files into a single collection, which is the output of the job:
 
 <notextile>
-<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">arv keep get e2ccd204bca37c77c0ba59fc470cd0f7+162</span>
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">arv keep ls e2ccd204bca37c77c0ba59fc470cd0f7+162</span>
 md5sum.txt
 md5sum.txt
 md5sum.txt
@@ -80,9 +76,4 @@ md5sum.txt
 </code></pre>
 </notextile>
 
-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.baseurl}}/sdk/python/crunch-utility-libraries.html#one_task_per_input which reduces the amount of boilerplate code required to handle parallel jobs.
-
-Next, "Constructing a Crunch pipeline":tutorial-new-pipeline.html
 
similarity index 99%
rename from doc/user/tutorials/tutorial-trait-search.html.textile.liquid
rename to doc/user/topics/tutorial-trait-search.html.textile.liquid
index 6402c7e1d3fa0cbb19b456e0a6a55b8949214551..001fbbc08267fe00e9c5508b661134895657a544 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
 title: "Querying the Metadata Database"
-
 ...
 
-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.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
diff --git a/doc/user/tutorials/intro-crunch.html.textile.liquid b/doc/user/tutorials/intro-crunch.html.textile.liquid
new file mode 100644 (file)
index 0000000..46b4d6c
--- /dev/null
@@ -0,0 +1,17 @@
+---
+layout: default
+navsection: userguide
+title: Introduction to Crunch
+...
+
+In "getting data from Keep,":tutorial-keep.html#arv-get 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.
+* Very large files may exceed the scratch space of the local disk.
+* We are only able to use the local CPU to process the file.
+
+The Arvados "Crunch" framework is designed to support processing very large data batches (gigabytes to terabytes) efficiently, and provides the following benefits:
+* Increase concurrency by running tasks asynchronously, using many CPUs and network interfaces at once (especially beneficial for CPU-bound and I/O-bound tasks respectively).
+* Track inputs, outputs, and settings so you can verify that the inputs, settings, and sequence of programs you used to arrive at an output is really what you think it was.
+* Ensure that your programs and workflows are repeatable with different versions of your code, OS updates, etc.
+* Interrupt and resume long-running jobs consisting of many short tasks.
+* Maintain timing statistics automatically, so they're there when you want them.
index 7b31e17818318f178da36b46562f65fc6ff89bd0..b555d77fe4a72d31db8157e4509f8698eaf03e2c 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
-title: "Running external programs"
-
+title: "Using Crunch to run external programs"
 ...
 
-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.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
@@ -27,7 +23,7 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano run-md
 
 Add the following code to use the @md5sum@ program to compute the hash of each file in a collection:
 
-<pre><code class="userinput">{% include 'run_md5sum_py' %}</code></pre>
+<notextile> {% code 'run_md5sum_py' as python %} </notextile>
 
 Make the file executable:
 
@@ -45,27 +41,25 @@ Next, add the file to @git@ staging, commit and push:
 You should now be able to run your new script using Crunch, with "script" referring to our new "run-md5sum.py" script.
 
 <notextile>
-<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_job &lt;&lt;EOF
-{
- "script": "run-md5sum.py",
- "script_version": "you:master",
- "script_parameters":
- {
-  "input": "c1bad4b39ca5a924e481008009d94e32+210"
- }
-}
-EOF</span>
-~/<b>you</b>/crunch_scripts$ <span class="userinput">arv job create --job "$(cat the_job)"</span>
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_pipeline &lt;&lt;EOF
 {
- ...
- "uuid":"qr1hi-xxxxx-xxxxxxxxxxxxxxx"
- ...
-}
-~/<b>you</b>/crunch_scripts$ <span class="userinput">arv job get --uuid qr1hi-xxxxx-xxxxxxxxxxxxxxx</span>
-{
- ...
- "output":"4d164b1658c261b9afc6b479130016a3+54",
- ...
+  "name":"Run external md5sum program",
+  "components":{
+    "do_hash":{
+      "script":"run-md5sum.py",
+      "script_parameters":{
+        "input":{
+          "required": true,
+          "dataclass": "Collection"
+        }
+      },
+      "script_version":"<b>you</b>:master"
+    }
+  }
 }
+EOF
+</span>~/<b>you</b>/crunch_scripts$ <span class="userinput">arv pipeline_template create --pipeline-template "$(cat ~/the_pipeline)"</span>
 </code></pre>
 </notextile>
+
+Your new pipeline template will appear on the "Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;templates":http://{{ site.arvados_workbench_host }}/pipeline_instances page.  You can run the "pipeline using workbench":tutorial-pipeline-workbench.html
index 130f59117653fd321eafae41d1b572695246cc06..245e89066b0cca292e6affcee6321df56dd8c13c 100644 (file)
@@ -2,12 +2,9 @@
 layout: default
 navsection: userguide
 navmenu: Tutorials
-title: "Writing a Crunch script"
-
+title: "Writing a pipeline"
 ...
 
-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.baseurl}}/user/getting_started/ssh-access.html#login, and have a "working environment.":{{site.baseurl}}/user/getting_started/check-environment.html*
@@ -25,7 +22,7 @@ First, you should do some basic configuration for git (you only need to do this
 ~$ <span class="userinput">git config --global user.email <b>you</b>@example.com</span></code></pre>
 </notextile>
 
-On the Arvados Workbench, navigate to _Compute %(rarr)&rarr;% Code repositories._  You should see two repositories, one named "arvados" (under the *name* column) and a second with your user name.  Next to *name* is the column *push_url*.  Copy the *push_url* cell associated with your repository.  This should look like <notextile><code>git@git.{{ site.arvados_api_host }}:<b>you</b>.git</code></notextile>.
+On the Arvados Workbench, navigate to "Compute %(rarr)&rarr;% Code repositories":http://{{site.arvados_workbench_host}}/repositories .  You should see a repository with your user name listed in the *name* column.  Next to *name* is the column *push_url*.  Copy the *push_url* value associated with your repository.  This should look like <notextile><code>git@git.{{ site.arvados_api_host }}:<b>you</b>.git</code></notextile>.
 
 Next, on the Arvados virtual machine, clone your git repository:
 
@@ -60,14 +57,14 @@ notextile. <pre>~/<b>you</b>/crunch_scripts$ <code class="userinput">nano hash.p
 
 Add the following code to compute the md5 hash of each file in a collection:
 
-<pre><code class="userinput">{% include 'tutorial_hash_script_py' %}</code></pre>
+<notextile> {% code 'tutorial_hash_script_py' as python %} </notextile>
 
 Make the file executable:
 
 notextile. <pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">chmod +x hash.py</span></code></pre>
 
 {% include 'notebox_begin' %}
-The below steps describe how to execute the script after committing changes to git. To test the script locally, please see the "debugging a crunch script":tutorial-job-debug.html page.
+The steps below describe how to execute the script after committing changes to git. To run a script locally for testing, please see "debugging a crunch script":{{site.baseurl}}/user/topics/tutorial-job-debug.html .
 
 {% include 'notebox_end' %}
 
@@ -96,34 +93,47 @@ To git@git.qr1hi.arvadosapi.com:you.git
  * [new branch]      master -> master</code></pre>
 </notextile>
 
-You should now be able to run your script using Crunch, similar to how we did it in the "first tutorial.":tutorial-job1.html  The field @"script_version"@ should be @you:master@ to tell Crunch to run the script at the head of the "master" git branch, which you just uploaded.
+h2. Create a pipeline template
+
+Next, create a file that contains the pipeline definition:
 
 <notextile>
-<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_job &lt;&lt;EOF
-{
- "script": "hash.py",
- "script_version": "you:master",
- "script_parameters":
- {
-  "input": "c1bad4b39ca5a924e481008009d94e32+210"
- }
-}
-EOF</span>
-~/<b>you</b>/crunch_scripts$ <span class="userinput">arv job create --job "$(cat ~/the_job)"</span>
-{
- ...
- "uuid":"qr1hi-xxxxx-xxxxxxxxxxxxxxx"
- ...
-}
-~/<b>you</b>/crunch_scripts$ <span class="userinput">arv job get --uuid qr1hi-xxxxx-xxxxxxxxxxxxxxx</span>
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cd ~</span>
+~$ <span class="userinput">cat &gt;the_pipeline &lt;&lt;EOF
 {
- ...
- "output":"880b55fb4470b148a447ff38cacdd952+54",
- ...
+  "name":"My first pipeline",
+  "components":{
+    "do_hash":{
+      "script":"hash.py",
+      "script_parameters":{
+        "input":{
+          "required": true,
+          "dataclass": "Collection"
+        }
+      },
+      "script_version":"<b>you</b>:master"
+    }
+  }
 }
-~/<b>you</b>/crunch_scripts$ <span class="userinput">arv keep get 880b55fb4470b148a447ff38cacdd952+54/md5sum.txt</span>
-44b8ae3fde7a8a88d2f7ebd237625b4f var-GS000016015-ASM.tsv.bz2
+EOF
+</span></code></pre>
+</notextile>
+
+* @cat@ is a standard Unix utility that simply copies standard input to standard output
+* @<<EOF@ tells the shell to direct the following lines into the standard input for @cat@ up until it sees the line @EOF@
+* @>the_pipeline@ redirects standard output to a file called @the_pipeline@
+* @"name"@ is a human-readable name for the pipeline
+* @"components"@ is a set of scripts that make up the pipeline
+* The component is listed with a human-readable name (@"do_hash"@ in this example)
+* @"script"@ specifies the name of the script to run.  The script is searched for in the "crunch_scripts/" subdirectory of the @git@ checkout specified by @"script_version"@.
+* @"script_version"@ specifies the version of the script that you wish to run.  This can be in the form of an explicit @git@ revision hash, or in the form "repository:branch" (in which case it will take the HEAD of the specified branch).  Arvados logs the script version that was used in the run, enabling you to go back and re-run any past job with the guarantee that the exact same code will be used as was used in the previous run.  You can access a list of available @git@ repositories on the Arvados workbench under "Compute %(rarr)&rarr;% Code repositories":http://{{site.arvados_workbench_host}}//repositories .
+* @"script_parameters"@ describes the parameters for the script.  In this example, there is one parameter called @input@ which is @required@ and is a @Collection@.
+
+Now, use @arv pipeline_template create@ tell Arvados about your pipeline template:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv pipeline_template create --pipeline-template "$(cat the_pipeline)"</span>
 </code></pre>
 </notextile>
 
-Next, "debugging a crunch script.":tutorial-job-debug.html
+Your new pipeline template will appear on the "Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;templates":http://{{ site.arvados_workbench_host }}/pipeline_instances page.  You can run the "pipeline using workbench":tutorial-pipeline-workbench.html
index 81963638641a71507086a1617e2dc885ab22179d..5a5e8796cbb67352256f9a06f24839f5d55281e2 100644 (file)
@@ -1,13 +1,9 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
-title: "Storing and Retrieving data using Arvados Keep"
-
+title: "Storing and Retrieving data using Keep"
 ...
 
-h1. Storing and Retrieving data using Arvados Keep
-
 This tutorial introduces you to the Arvados file storage system.
 
 
@@ -59,7 +55,7 @@ c1bad4b39ca5a924e481008009d94e32+210
 
 The output value @c1bad4b39ca5a924e481008009d94e32+210@ from @arv keep put@ is the Keep locator.  This enables you to access the file you just uploaded, and is explained in the next section.
 
-h2. Putting a directory
+h2(#dir). Putting a directory
 
 You can also use @arv keep put@ to add an entire directory:
 
@@ -74,47 +70,56 @@ You can also use @arv keep put@ to add an entire directory:
 </code></pre>
 </notextile>
 
+The locator @887cd41e9c613463eab2f0d885c6dd96+83@ represents a collection with multiple files.
+
 h1. Getting Data from Keep
 
-In Keep, information is stored in *data blocks*.  Data blocks are normally between 1 byte and 64 megabytes in size.  If a file exceeds the maximum size of a single data block, the file will be split across multiple data blocks until the entire file can be stored.  These data blocks may be stored and replicated across multiple disks, servers, or clusters.  Each data block has its own identifier for the contents of that specific data block.
+h2. Using Workbench
 
-In order to reassemble the file, Keep stores a *collection* data block which lists in sequence the data blocks that make up the original file.  A collection data block may store the information for multiple files, including a directory structure.
+You may access collections through the "Collections section of Arvados Workbench":https://{{ site.arvados_workbench_host }}/collections located at "https://{{ site.arvados_workbench_host }}/collections":https://{{ site.arvados_workbench_host }}/collections .  You can also access individual collections and individual files within a collection.  Some examples:
 
-In this example we will use @c1bad4b39ca5a924e481008009d94e32+210@ which we added to keep in the previous section.  First let us examine the contents of this collection using @arv keep get@:
+* "https://{{ site.arvados_workbench_host }}/collections/c1bad4b39ca5a924e481008009d94e32+210":https://{{ site.arvados_workbench_host }}/collections/c1bad4b39ca5a924e481008009d94e32+210
+* "https://{{ site.arvados_workbench_host }}/collections/887cd41e9c613463eab2f0d885c6dd96+83/alice.txt":https://{{ site.arvados_workbench_host }}/collections/887cd41e9c613463eab2f0d885c6dd96+83/alice.txt
+
+h2(#arv-get). Using arv-get
+
+You can view the contents of a collection using @arv keep ls@:
 
 <notextile>
-<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep get c1bad4b39ca5a924e481008009d94e32+210</span>
-. 204e43b8a1185621ca55a94839582e6f+67108864 b9677abbac956bd3e86b1deb28dfac03+67108864 fc15aff2a762b13f521baf042140acec+67108864 323d2a3ce20370c4ca1d3462a344f8fd+25885655 0:227212247:var-GS000016015-ASM.tsv.bz2
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep ls c1bad4b39ca5a924e481008009d94e32+210</span>
+var-GS000016015-ASM.tsv.bz2
 </code></pre>
-</notextile>
 
-The command @arv keep get@ fetches the contents of the locator @c1bad4b39ca5a924e481008009d94e32+210@.  This is a locator for a collection data block, so it fetches the contents of the collection.  In this example, this collection consists of a single file @var-GS000016015-ASM.tsv.bz2@ which is 227212247 bytes long, and is stored using four sequential data blocks, <code>204e43b8a1185621ca55a94839582e6f+67108864</code>, <code>b9677abbac956bd3e86b1deb28dfac03+67108864</code>, <code>fc15aff2a762b13f521baf042140acec+67108864</code>, <code>323d2a3ce20370c4ca1d3462a344f8fd+25885655</code>.
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep ls 887cd41e9c613463eab2f0d885c6dd96+83</span>
+alice.txt
+bob.txt
+carol.txt
+</code></pre>
+</notextile>
 
-Let's use @arv keep get@ to download the first datablock:
+Use @-s@ to print file sizes rounded up to the nearest kilobyte:
 
-notextile. <pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep get 204e43b8a1185621ca55a94839582e6f+67108864 &gt; block1</span></code></pre>
+<notextile>
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep ls -s c1bad4b39ca5a924e481008009d94e32+210</span>
+221887 var-GS000016015-ASM.tsv.bz2
+</code></pre>
+</notextile>
 
-Let's look at the size and compute the md5 hash of @block1@:
+Use @arv keep get@ to download the contents of a collection and place it in the directory specified in the second argument (in this example, @.@ for the current directory):
 
 <notextile>
-<pre><code>/scratch/<b>you</b>$ <span class="userinput">ls -l block1</span>
--rw-r--r-- 1 you group 67108864 Dec  9 20:14 block1
-/scratch/<b>you</b>$ <span class="userinput">md5sum block1</span>
-204e43b8a1185621ca55a94839582e6f  block1
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep get c1bad4b39ca5a924e481008009d94e32+210/ .</span>
 </code></pre>
 </notextile>
 
-Notice that the block identifer <code>204e43b8a1185621ca55a94839582e6f+67108864</code> of:
-* the md5 hash @204e43b8a1185621ca55a94839582e6f@ which matches the md5 hash of @block1@
-* a size hint @67108864@ which matches the size of @block1@
-
-Next, let's use @arv keep get@ to download and reassemble @var-GS000016015-ASM.tsv.bz2@ using the following command:
+You can also download individual files:
 
 <notextile>
-<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep get c1bad4b39ca5a924e481008009d94e32+210/var-GS000016015-ASM.tsv.bz2 .</span>
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep get 887cd41e9c613463eab2f0d885c6dd96+83/alice.txt .</span>
 </code></pre>
+</notextile>
 
-This downloads the file @var-GS000016015-ASM.tsv.bz2@ described by collection @c1bad4b39ca5a924e481008009d94e32+210@ from Keep and places it into the local directory.  Now that we have the file, we can compute the md5 hash of the complete file:
+With a local copy of the file, we can do some computation, for example computing the md5 hash of the complete file:
 
 <notextile>
 <pre><code>/scratch/<b>you</b>$ <span class="userinput">md5sum var-GS000016015-ASM.tsv.bz2</span>
@@ -122,22 +127,40 @@ This downloads the file @var-GS000016015-ASM.tsv.bz2@ described by collection @c
 </code></pre>
 </notextile>
 
-h2. Accessing Collections
+h2. Using arv-mount
 
-There are a couple of other ways to access a collection.  You may view the contents of a collection using @arv keep ls@:
+Use @arv-mount@ to take advantage of the "File System in User Space / FUSE":http://fuse.sourceforge.net/ feature of the Linux kernel to mount a Keep collection as if it were a regular directory tree.
 
 <notextile>
-<pre><code>/scratch/<b>you</b>$ <span class="userinput">arv keep ls c1bad4b39ca5a924e481008009d94e32+210</span>
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">mkdir mnt</span>
+/scratch/<b>you</b>$ <span class="userinput">arv-mount --collection c1bad4b39ca5a924e481008009d94e32+210 mnt &</span>
+/scratch/<b>you</b>$ <span class="userinput">cd mnt</span>
+/scratch/<b>you</b>/mnt$ <span class="userinput">ls</span>
 var-GS000016015-ASM.tsv.bz2
-/scratch/<b>you</b>$ <span class="userinput">arv keep ls -s c1bad4b39ca5a924e481008009d94e32+210</span>
-221887 var-GS000016015-ASM.tsv.bz2
+/scratch/<b>you</b>/mnt$ <span class="userinput">md5sum var-GS000016015-ASM.tsv.bz2</span>
+44b8ae3fde7a8a88d2f7ebd237625b4f  var-GS000016015-ASM.tsv.bz2
+/scratch/<b>you</b>/mnt$ <span class="userinput">cd ..</span>
+/scratch/<b>you</b>$ <span class="userinput">fusermount -u mnt</span>
 </code></pre>
 </notextile>
 
-* @-s@ prints file sizes in kilobytes
+You can also mount the entire Keep namespace in "magic directory" mode:
 
-You may also access through the Arvados Workbench using a URI similar to this, where the last part of the path is the Keep locator:
+<notextile>
+<pre><code>/scratch/<b>you</b>$ <span class="userinput">mkdir mnt</span>
+/scratch/<b>you</b>$ <span class="userinput">arv-mount mnt &</span>
+/scratch/<b>you</b>$ <span class="userinput">cd mnt/c1bad4b39ca5a924e481008009d94e32+210</span>
+/scratch/<b>you</b>/mnt/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">ls</span>
+var-GS000016015-ASM.tsv.bz2
+/scratch/<b>you</b>/mnt/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">md5sum var-GS000016015-ASM.tsv.bz2</span>
+44b8ae3fde7a8a88d2f7ebd237625b4f  var-GS000016015-ASM.tsv.bz2
+/scratch/<b>you</b>/mnt/c1bad4b39ca5a924e481008009d94e32+210$ <span class="userinput">cd ../..</span>
+/scratch/<b>you</b>$ <span class="userinput">fusermount -u mnt</span>
+</code></pre>
+</notextile>
 
-"https://workbench.{{ site.arvados_api_host }}/collections/c1bad4b39ca5a924e481008009d94e32+210":https://workbench.{{ site.arvados_api_host }}/collections/c1bad4b39ca5a924e481008009d94e32+210
+Using @arv-mount@ has several significant benefits:
 
-You are now ready to proceed to the next tutorial, "running a crunch job.":tutorial-job1.html
+* You can browse, open and read Keep entries as if they are regular files.
+* It is easy for existing tools to access files in Keep.
+* Data is downloaded on demand, it is not necessary to download an entire file or collection to start processing
index d128b4b1951e04c887c4a8f57015237f0df65336..d218c3b9a4f2b44f34fa2446f53533964b89c4e9 100644 (file)
@@ -1,29 +1,28 @@
 ---
 layout: default
 navsection: userguide
-navmenu: Tutorials
-title: "Constructing a Crunch pipeline"
-
+title: "Writing a multi-step pipeline"
 ...
 
-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.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.
+
 h2. Create a new script
 
-Our second script will filter the output of @parallel_hash.py@ and only include hashes that start with 0.  Create a new script in @crunch_scripts/@ called @0-filter.py@:
+Our second script will filter the output of @hash.py@ and only include hashes that start with 0.  Create a new script in <notextile><code>~/<b>you</b>/crunch_scripts/</code></notextile> called @0-filter.py@:
 
-<pre><code class="userinput">{% include '0_filter_py' %}</code></pre>
+<notextile> {% code '0_filter_py' as python %} </notextile>
 
 Now add it to git:
 
 <notextile>
-<pre><code>$ <span class="userinput">git add 0-filter.py</span>
-$ <span class="userinput">git commit -m"zero filter"</span>
-$ <span class="userinput">git push origin master</span>
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">chmod +x 0-filter.py</span>
+~/<b>you</b>/crunch_scripts$ <span class="userinput">git add 0-filter.py</span>
+~/<b>you</b>/crunch_scripts$ <span class="userinput">git commit -m"zero filter"</span>
+~/<b>you</b>/crunch_scripts$ <span class="userinput">git push origin master</span>
 </code></pre>
 </notextile>
 
@@ -32,16 +31,19 @@ h2. Create a pipeline template
 Next, create a file that contains the pipeline definition:
 
 <notextile>
-<pre><code>$ <span class="userinput">cat &gt;the_pipeline &lt;&lt;EOF
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">cat &gt;~/the_pipeline &lt;&lt;EOF
 {
-  "name":"my_first_pipeline",
+  "name":"Filter md5 hash values",
   "components":{
     "do_hash":{
-      "script":"parallel-hash.py",
+      "script":"hash.py",
       "script_parameters":{
-        "input": "887cd41e9c613463eab2f0d885c6dd96+83"
+        "input":{
+          "required": true,
+          "dataclass": "Collection"
+        }
       },
-      "script_version":"you:master"
+      "script_version":"<b>you</b>:master"
     },
     "filter":{
       "script":"0-filter.py",
@@ -50,109 +52,22 @@ Next, create a file that contains the pipeline definition:
           "output_of":"do_hash"
         }
       },
-      "script_version":"you:master"
+      "script_version":"<b>you</b>:master"
     }
   }
 }
 EOF
-</code></pre>
+</span></code></pre>
 </notextile>
 
-* @"name"@ is a human-readable name for the pipeline
-* @"components"@ is a set of scripts that make up the pipeline
-* Each component is listed with a human-readable name (@"do_hash"@ and @"filter"@ in this example)
-* Each item in @"components"@ is a single Arvados job, and uses the same format that we saw previously with @arv job create@
-* @"output_of"@ indicates that the @"input"@ of @"filter"@ is the @"output"@ of the @"do_hash"@ component.  This is a _dependency_.  Arvados uses the dependencies between jobs to automatically determine the correct order to run the jobs.
+* @"output_of"@ indicates that the @input@ of the @do_hash@ component is connected to the @output@ of @filter@.  This is a _dependency_.  Arvados uses the dependencies between jobs to automatically determine the correct order to run the jobs.
 
 Now, use @arv pipeline_template create@ tell Arvados about your pipeline template:
 
 <notextile>
-<pre><code>$ <span class="userinput">arv pipeline_template create --pipeline-template "$(cat the_pipeline)"</span>
-qr1hi-p5p6p-xxxxxxxxxxxxxxx
+<pre><code>~/<b>you</b>/crunch_scripts$ <span class="userinput">arv pipeline_template create --pipeline-template "$(cat ~/the_pipeline)"</span>
 </code></pre>
 </notextile>
 
-Your new pipeline template will appear on the Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;templates page.
-
-h3. Running a pipeline
-
-Run the pipeline using @arv pipeline run@, using the UUID that you received from @arv pipeline create@:
-
-<notextile>
-<pre><code>$ <span class="userinput">arv pipeline run --template qr1hi-p5p6p-xxxxxxxxxxxxxxx</span>
-2013-12-16 14:08:40 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
-do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 queued 2013-12-16T14:08:40Z
-filter  -                           -
-2013-12-16 14:08:51 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
-do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 e2ccd204bca37c77c0ba59fc470cd0f7+162
-filter  qr1hi-8i9sb-w5k40fztqgg9i2x queued 2013-12-16T14:08:50Z
-2013-12-16 14:09:01 +0000 -- pipeline_instance qr1hi-d1hrv-vxzkp38nlde9yyr
-do_hash qr1hi-8i9sb-hoyc2u964ecv1s6 e2ccd204bca37c77c0ba59fc470cd0f7+162
-filter  qr1hi-8i9sb-w5k40fztqgg9i2x 735ac35adf430126cf836547731f3af6+56
-</code></pre>
-</notextile>
-
-This instantiates your pipeline and displays a live feed of its status.  The new pipeline instance will also show up on the Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;instances page.
-
-Arvados adds each pipeline component to the job queue as its dependencies are satisfied (or immediately if it has no dependencies) and finishes when all components are completed or failed and there is no more work left to do.
-
-The Keep locators of the output of each of @"do_hash"@ and @"filter"@ component are available from the output log shown above.  The output is also available on the Workbench by navigating to %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;instances %(rarr)&rarr;% pipeline uuid under the *id* column %(rarr)&rarr;% components.
-
-<notextile>
-<pre><code>$ <span class="userinput">arv keep get e2ccd204bca37c77c0ba59fc470cd0f7+162/md5sum.txt</span>
-0f1d6bcf55c34bed7f92a805d2d89bbf alice.txt
-504938460ef369cd275e4ef58994cffe bob.txt
-8f3b36aff310e06f3c5b9e95678ff77a carol.txt
-$ <span class="userinput">arv keep get 735ac35adf430126cf836547731f3af6+56</span>
-0f1d6bcf55c34bed7f92a805d2d89bbf alice.txt
-</code></pre>
-</notextile>
-
-Indeed, the filter has picked out just the "alice" file as having a hash that starts with 0.
-
-h3. Running a pipeline with different parameters
-
-Notice that the pipeline definition explicitly specifies the Keep locator for the input:
-
-<notextile>
-<pre><code>...
-    "do_hash":{
-      "script_parameters":{
-        "input": "887cd41e9c613463eab2f0d885c6dd96+83"
-      },
-    }
-...
-</code></pre>
-</notextile>
-
-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+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  -                           -
-2013-12-17 20:31:34 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
-do_hash qr1hi-8i9sb-rffhuay4jryl2n2 {:done=>1, :running=>1, :failed=>0, :todo=>0}
-filter  -                           -
-2013-12-17 20:31:44 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
-do_hash qr1hi-8i9sb-rffhuay4jryl2n2 {:done=>1, :running=>1, :failed=>0, :todo=>0}
-filter  -                           -
-2013-12-17 20:31:55 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
-do_hash qr1hi-8i9sb-rffhuay4jryl2n2 880b55fb4470b148a447ff38cacdd952+54
-filter  qr1hi-8i9sb-j347g1sqovdh0op queued 2013-12-17T20:31:55Z
-2013-12-17 20:32:05 +0000 -- pipeline_instance qr1hi-d1hrv-tlkq20687akys8e
-do_hash qr1hi-8i9sb-rffhuay4jryl2n2 880b55fb4470b148a447ff38cacdd952+54
-filter  qr1hi-8i9sb-j347g1sqovdh0op fb728f0ffe152058fa64b9aeed344cb5+54
-</code></pre>
-</notextile>
-
-Now check the output:
-
-<notextile>
-<pre><code>$ <span class="userinput">arv keep ls -s fb728f0ffe152058fa64b9aeed344cb5+54</span>
-0 0-filter.txt
-</code></pre>
-</notextile>
+Your new pipeline template will appear on the "Workbench %(rarr)&rarr;% Compute %(rarr)&rarr;% Pipeline&nbsp;templates":http://{{ site.arvados_workbench_host }}/pipeline_templates page.
 
-Here the filter script output is empty, so none of the files in the collection have hash code that start with 0.
diff --git a/doc/user/tutorials/tutorial-pipeline-workbench.html.textile.liquid b/doc/user/tutorials/tutorial-pipeline-workbench.html.textile.liquid
new file mode 100644 (file)
index 0000000..52dafb7
--- /dev/null
@@ -0,0 +1,25 @@
+---
+layout: default
+navsection: userguide
+title: "Running a pipeline using Workbench"
+...
+
+notextile. <div class="spaced-out">
+
+# Go to "Collections":http://{{ site.arvados_workbench_host }}/collections .
+# On the collections page, go to the search box <span class="glyphicon glyphicon-search"></span> and search for "tutorial".
+# This should yield a collection with the contents "var-GS000016015-ASM.tsv.bz2"
+# Click on the check box to the left of "var-GS000016015-ASM.tsv.bz2".  This puts the collection in your persistent selection list.  Click on the paperclip <span class="glyphicon glyphicon-paperclip"></span> in the upper right to get a dropdown menu listing your current selections.
+# Go to "Pipeline templates":http://{{ site.arvados_workbench_host }}/pipeline_templates .
+# Look for a pipeline named "Tutorial pipeline".
+# Click on the play button <span class="glyphicon glyphicon-play"></span> to the left of "Tutorial pipeline".  This will take you to a new page to configure the pipeline.
+# Under *parameter* look for "input".  Set the value of "input" by clicking on on "none" to get a editing popup.  At the top of the selection list in the editing popup will be the collection that you selected in step 4.
+# You can now click on "Run pipeline" in the upper right to start the pipeline.
+# This will reload the page with the pipeline queued to run.
+# The page refreshes automatically every 15 seconds.  You should see the pipeline running, and then finish successfully.
+# Once it is finished, click on the link under the *output* column.  This will take you to the collection page for the output of this pipeline.
+# Click on "md5sum.txt" to see the actual file that is the output of this pipeline.
+# On the collection page, click on the "Provenance graph" tab to see a graphical representation of the data elements and pipelines that were involved in generating this file.
+
+notextile. </div>
+
index 545a0d8f5a31f58421e263288540c8eff9f4ecc7..0be882a48b45e15b5b7ec9bc8e0b2743390e60c0 100644 (file)
@@ -1,4 +1,5 @@
 require 'zenweb'
+require 'liquid'
 
 module ZenwebLiquid
   VERSION = '0.0.1'
@@ -15,7 +16,6 @@ module Zenweb
     ##
     # Render a page's liquid and return the intermediate result
     def liquid template, content, page, binding = TOPLEVEL_BINDING
-      require 'liquid'
       Liquid::Template.file_system = Liquid::LocalFileSystem.new(File.join(File.dirname(Rake.application().rakefile), "_includes"))
       unless defined? @liquid_template
         @liquid_template = Liquid::Template.parse(template)
@@ -38,4 +38,35 @@ module Zenweb
       @liquid_template.render(vars)
     end
   end
+
+  class LiquidCode < Liquid::Include
+    Syntax = /(#{Liquid::QuotedFragment}+)(\s+(?:as)\s+(#{Liquid::QuotedFragment}+))?/o
+
+    def initialize(tag_name, markup, tokens)
+      Liquid::Tag.instance_method(:initialize).bind(self).call(tag_name, markup, tokens)
+
+      if markup =~ Syntax
+        @template_name = $1
+        @language = $3
+        @attributes    = {}
+      else
+        raise SyntaxError.new("Error in tag 'code' - Valid syntax: include '[code_file]' as '[language]'")
+      end
+    end
+    
+    def render(context)
+      require 'coderay'
+
+      partial = load_cached_partial(context)
+      html = ''
+
+      context.stack do
+        html = CodeRay.scan(partial.root.nodelist.join, @language).div
+      end
+
+      html
+    end
+
+    Liquid::Template.register_tag('code', LiquidCode)    
+  end
 end
index ce0bf2a2095bfd84051cf7bff84329445502aa00..f521b8c90135dfdcf06923c2b4d6f6ad0c56d14f 100644 (file)
@@ -39,27 +39,17 @@ Prerequisites
      none   /cgroup    cgroup    defaults    0    0
      $ sudo mount /cgroup
         </pre>
-
-  3. Enable IPv4 forwarding:
-
-     <pre>
-     $ grep ipv4.ip_forward /etc/sysctl.conf
-     net.ipv4.ip_forward=1
-     $ sudo sysctl net.ipv4.ip_forward=1
-     </pre>
         
-  4. [Download and run a docker binary from docker.io.](http://docs.docker.io/en/latest/installation/binaries/)
+  3. [Download and run a docker binary from docker.io.](http://docs.docker.io/en/latest/installation/binaries/)
 
-* Ruby (any version)
+* Ruby (version 1.9.3 or greater)
 
 * sudo privileges to run `debootstrap`
 
 Building
 --------
 
-1. Copy `config.yml.example` to `config.yml` and edit it with settings
-   for your installation.
-2. Run `make` to build the following Docker images:
+Type `./build.sh` to configure and build the following Docker images:
 
    * arvados/api       - the Arvados API server
    * arvados/doc       - Arvados documentation
@@ -67,13 +57,10 @@ Building
    * arvados/workbench - the Arvados console
    * arvados/sso       - the Arvados single-signon authentication server
 
-   You may also build Docker images for individual Arvados services:
-
-        $ make api-image
-        $ make doc-image
-        $ make warehouse-image
-        $ make workbench-image
-        $ make sso-image
+`build.sh` will generate reasonable defaults for all configuration
+settings.  If you want more control over the way Arvados is
+configured, first copy `config.yml.example` to `config.yml` and edit
+it with appropriate configuration settings, and then run `./build.sh`.
 
 Running
 -------
index 89dee6923c5c70ac92b2de7d61c1b3e6c7d010c4..f453675ea8ebb99a3d6fb0a2597afc9e852661d9 100755 (executable)
@@ -89,7 +89,7 @@ begin
 rescue LoadError
   abort <<-EOS
 
-Please install all required gems: 
+Please install all required gems:
 
   gem install activesupport andand curb google-api-client json oj trollop
 
@@ -148,8 +148,13 @@ class ArvadosClient < Google::APIClient
   end
 end
 
-client = ArvadosClient.new(:host => ENV['ARVADOS_API_HOST'], :application_name => 'arvados-cli', :application_version => '1.0')
-arvados = client.discovered_api('arvados', ENV['ARVADOS_API_VERSION'])
+begin
+  client = ArvadosClient.new(:host => ENV['ARVADOS_API_HOST'], :application_name => 'arvados-cli', :application_version => '1.0')
+  arvados = client.discovered_api('arvados', ENV['ARVADOS_API_VERSION'])
+rescue Exception => e
+  puts "Failed to connect to Arvados API server: #{e}"
+  exit 1
+end
 
 def to_boolean(s)
   !!(s =~ /^(true|t|yes|y|1)$/i)
@@ -170,8 +175,8 @@ def help_methods(discovery_document, resource, method=nil)
   end
   banner += "\n"
   STDERR.puts banner
-  
-  if not method.nil? and method != '--help' then 
+
+  if not method.nil? and method != '--help' then
     Trollop::die ("Unknown method #{method.inspect} " +
                   "for resource #{resource.inspect}")
   end
@@ -194,7 +199,7 @@ def help_resources(discovery_document, resource)
   banner += "\n"
   STDERR.puts banner
 
-  if not resource.nil? and resource != '--help' then 
+  if not resource.nil? and resource != '--help' then
     Trollop::die "Unknown resource type #{resource.inspect}"
   end
   exit 255
@@ -320,7 +325,7 @@ when
     curl.headers['Accept'] = 'text/plain'
     curl.headers['Authorization'] = "OAuth2 #{ENV['ARVADOS_API_TOKEN']}"
     if ENV['ARVADOS_API_HOST_INSECURE']
-      curl.ssl_verify_peer = false 
+      curl.ssl_verify_peer = false
       curl.ssl_verify_host = false
     end
     if global_opts[:verbose]
@@ -364,5 +369,3 @@ else
     puts results['uuid']
   end
 end
-
-
index dd89ad50b2b8471a2e9f23f76d5033d0f0f6183a..1e62a52c04dcf9edbd9106a42d9c2124d07967e3 100755 (executable)
@@ -519,12 +519,13 @@ class WhRunPipelineInstance
                 if p.is_a? Hash and p[:output_of] == cname.to_s
                   debuglog "parameter #{c2name}::#{pname} == #{c[:job][:output]}"
                   c2[:script_parameters][pname] = c[:job][:output]
+                  moretodo = true
                 end
               end
             end
           elsif c[:job][:running] ||
               (!c[:job][:started_at] && !c[:job][:cancelled_at])
-            moretodo ||= true
+            moretodo = true
           elsif c[:job][:cancelled_at]
             debuglog "component #{cname} job #{c[:job][:uuid]} cancelled."
           end
@@ -557,12 +558,14 @@ class WhRunPipelineInstance
           ended += 1
           if c[:job][:success] == true
             succeeded += 1
+          elsif c[:job][:success] == false
+            failed += 1
           end
         end
       end
     end
     
-    if ended == @components.length
+    if ended == @components.length or failed > 0
       @instance[:active] = false
       @instance[:success] = (succeeded == @components.length)
     end
index 2ba36f2b25ba939957ee3c6fb81baad66797a16e..c09826848ef746a2ca9c8dc1ef646533deb5207c 100755 (executable)
@@ -33,6 +33,12 @@ Path to .git directory where the specified commit is found.
 
 Arvados API authorization token to use during the course of the job.
 
+=item --no-clear-tmp
+
+Do not clear per-job/task temporary directories during initial job
+setup. This can speed up development and debugging when running jobs
+locally.
+
 =back
 
 =head1 RUNNING JOBS LOCALLY
@@ -74,6 +80,7 @@ use Getopt::Long;
 use Warehouse;
 use Warehouse::Stream;
 use IPC::System::Simple qw(capturex);
+use Fcntl ':flock';
 
 $ENV{"TMPDIR"} ||= "/tmp";
 unless (defined $ENV{"CRUNCH_TMP"}) {
@@ -92,11 +99,13 @@ my $force_unlock;
 my $git_dir;
 my $jobspec;
 my $job_api_token;
+my $no_clear_tmp;
 my $resume_stash;
 GetOptions('force-unlock' => \$force_unlock,
            'git-dir=s' => \$git_dir,
            'job=s' => \$jobspec,
            'job-api-token=s' => \$job_api_token,
+           'no-clear-tmp' => \$no_clear_tmp,
            'resume-stash=s' => \$resume_stash,
     );
 
@@ -323,6 +332,12 @@ else
 }
 
 
+if (!$have_slurm)
+{
+  must_lock_now("$ENV{CRUNCH_TMP}/.lock", "a job is already running here.");
+}
+
+
 my $build_script;
 
 
@@ -331,6 +346,11 @@ $ENV{"CRUNCH_SRC_COMMIT"} = $Job->{script_version};
 my $skip_install = ($local_job && $Job->{script_version} =~ m{^/});
 if ($skip_install)
 {
+  if (!defined $no_clear_tmp) {
+    my $clear_tmp_cmd = 'rm -rf $JOB_WORK $CRUNCH_TMP/opt $CRUNCH_TMP/src*';
+    system($clear_tmp_cmd) == 0
+       or croak ("`$clear_tmp_cmd` failed: ".($?>>8));
+  }
   $ENV{"CRUNCH_SRC"} = $Job->{script_version};
   for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python") {
     if (-d $src_path) {
@@ -351,22 +371,24 @@ else
   Log (undef, "Install revision ".$Job->{script_version});
   my $nodelist = join(",", @node);
 
-  # Clean out crunch_tmp/work, crunch_tmp/opt, crunch_tmp/src*
+  if (!defined $no_clear_tmp) {
+    # Clean out crunch_tmp/work, crunch_tmp/opt, crunch_tmp/src*
 
-  my $cleanpid = fork();
-  if ($cleanpid == 0)
-  {
-    srun (["srun", "--nodelist=$nodelist", "-D", $ENV{'TMPDIR'}],
-         ['bash', '-c', 'if mount | grep -q $JOB_WORK/; then sudo /bin/umount $JOB_WORK/* 2>/dev/null; fi; sleep 1; rm -rf $JOB_WORK $CRUNCH_TMP/opt $CRUNCH_TMP/src*']);
-    exit (1);
-  }
-  while (1)
-  {
-    last if $cleanpid == waitpid (-1, WNOHANG);
-    freeze_if_want_freeze ($cleanpid);
-    select (undef, undef, undef, 0.1);
+    my $cleanpid = fork();
+    if ($cleanpid == 0)
+    {
+      srun (["srun", "--nodelist=$nodelist", "-D", $ENV{'TMPDIR'}],
+           ['bash', '-c', 'if mount | grep -q $JOB_WORK/; then sudo /bin/umount $JOB_WORK/* 2>/dev/null; fi; sleep 1; rm -rf $JOB_WORK $CRUNCH_TMP/opt $CRUNCH_TMP/src*']);
+      exit (1);
+    }
+    while (1)
+    {
+      last if $cleanpid == waitpid (-1, WNOHANG);
+      freeze_if_want_freeze ($cleanpid);
+      select (undef, undef, undef, 0.1);
+    }
+    Log (undef, "Clean-work-dir exited $?");
   }
-  Log (undef, "Clean-work-dir exited $?");
 
   # Install requested code version
 
@@ -463,6 +485,12 @@ else
   Log (undef, "Install exited $?");
 }
 
+if (!$have_slurm)
+{
+  # Grab our lock again (we might have deleted and re-created CRUNCH_TMP above)
+  must_lock_now("$ENV{CRUNCH_TMP}/.lock", "a job is already running here.");
+}
+
 
 
 foreach (qw (script script_version script_parameters runtime_constraints))
@@ -580,10 +608,6 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
       $command .=
          "&& perl -";
     }
-    $ENV{"PYTHONPATH"} =~ s{^}{:} if $ENV{"PYTHONPATH"};
-    $ENV{"PYTHONPATH"} =~ s{^}{$ENV{CRUNCH_SRC}/sdk/python}; # xxx hack
-    $ENV{"PYTHONPATH"} =~ s{^}{$ENV{CRUNCH_SRC}/arvados/sdk/python:}; # xxx hack
-    $ENV{"PYTHONPATH"} =~ s{$}{:/usr/local/arvados/src/sdk/python}; # xxx hack
     $command .=
         "&& exec arv-mount $ENV{TASK_KEEPMOUNT} --exec $ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
     my @execargs = ('bash', '-c', $command);
@@ -1350,6 +1374,15 @@ sub ban_node_by_slot {
   Log (undef, "backing off node " . $slot[$slotid]->{node}->{name} . " for 60 seconds");
 }
 
+sub must_lock_now
+{
+  my ($lockfile, $error_message) = @_;
+  open L, ">", $lockfile or croak("$lockfile: $!");
+  if (!flock L, LOCK_EX|LOCK_NB) {
+    croak("Can't lock $lockfile: $error_message\n");
+  }
+}
+
 __DATA__
 #!/usr/bin/perl
 
index ff29919f1bf3c6a0e7e60245333ad454164f2df5..fb3dea43acc6872d11ccdbc5456c2d87e5c15c73 100644 (file)
@@ -22,6 +22,7 @@ from keep import *
 from stream import *
 import config
 import errors
+import util
 
 def normalize_stream(s, stream):
     stream_tokens = [s]
index ac9cd9bcf6088cbc54751ec340d143b66c423154..5e773dfbc6c0185f32b02b76ab3255692a8b4cbe 100755 (executable)
@@ -51,10 +51,14 @@ with "--".
         # wait until the driver is finished initializing
         operations.initlock.wait()
 
+        rc = 255
         try:
             rc = subprocess.call(args.exec_args, shell=False)
-        except:
-            rc = 255
+        except OSError as e:
+            sys.stderr.write('arv-mount: %s -- exec %s\n' % (str(e), args.exec_args))
+            rc = e.errno
+        except Exception as e:
+            sys.stderr.write('arv-mount: %s\n' % str(e))
         finally:
             subprocess.call(["fusermount", "-u", "-z", args.mountpoint])
 
index db011f15c3c55d9f9465e794264e2d8f448d183e..ded0358394f1aa0dc8ffb4fa37b1aab41ca57043 100644 (file)
@@ -5,7 +5,13 @@ gem 'rails', '~> 3.2.0'
 # Bundle edge Rails instead:
 # gem 'rails',     :git => 'git://github.com/rails/rails.git'
 
-#gem 'sqlite3'
+group :test, :development do
+  gem 'sqlite3'
+end
+
+# This might not be needed in :test and :development, but we load it
+# anyway to make sure it always gets in Gemfile.lock and to help
+# reveal install problems sooner rather than later.
 gem 'pg'
 
 # Start using multi_json once we are on Rails 3.2;
@@ -57,4 +63,4 @@ gem 'test_after_commit', :group => :test
 gem 'google-api-client', '~> 0.6.3'
 gem 'trollop'
 
-#gem 'arvados-cli', '>= 0.1.20140307112652'
+gem 'arvados-cli', '>= 0.1.20140311162926'
index c78f3a7befad32cf4b0bedc0b1b89b4752a00fa2..c734ab560b17b6517125cb5118c1904afd958d3b 100644 (file)
@@ -35,6 +35,14 @@ GEM
     addressable (2.3.5)
     andand (1.3.3)
     arel (3.0.2)
+    arvados-cli (0.1.20140311162926)
+      activesupport (~> 3.2, >= 3.2.13)
+      andand (~> 1.3, >= 1.3.3)
+      curb (~> 0.8)
+      google-api-client (~> 0.6.3)
+      json (~> 1.7, >= 1.7.7)
+      oj (~> 2.0, >= 2.0.3)
+      trollop (~> 2.0)
     autoparse (0.3.3)
       addressable (>= 2.3.1)
       extlib (>= 0.9.15)
@@ -53,6 +61,7 @@ GEM
       coffee-script-source
       execjs
     coffee-script-source (1.6.3)
+    curb (0.8.5)
     daemon_controller (1.1.7)
     erubis (2.7.0)
     execjs (2.0.2)
@@ -160,6 +169,7 @@ GEM
       multi_json (~> 1.0)
       rack (~> 1.0)
       tilt (~> 1.1, != 1.3.0)
+    sqlite3 (1.3.8)
     test_after_commit (0.2.2)
     therubyracer (0.12.0)
       libv8 (~> 3.16.14.0)
@@ -182,6 +192,7 @@ PLATFORMS
 DEPENDENCIES
   acts_as_api
   andand
+  arvados-cli (>= 0.1.20140311162926)
   coffee-rails (~> 3.2.0)
   google-api-client (~> 0.6.3)
   jquery-rails
@@ -195,6 +206,7 @@ DEPENDENCIES
   redis
   rvm-capistrano
   sass-rails (>= 3.2.0)
+  sqlite3
   test_after_commit
   therubyracer
   trollop
index 34a22aa809cb8d794056c690ac39eabcf1ad9f8f..fa189aa80d2e3dcb4f1ee9025c86c4c27151fc01 100644 (file)
@@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
   before_filter :catch_redirect_hint
 
   before_filter :load_where_param, :only => :index
+  before_filter :load_filters_param, :only => :index
   before_filter :find_objects_for_index, :only => :index
   before_filter :find_object_by_uuid, :except => [:index, :create,
                                                   :render_error,
@@ -38,7 +39,7 @@ class ApplicationController < ActionController::Base
     if @object.save
       show
     else
-      render_error "Save failed"
+      raise "Save failed"
     end
   end
 
@@ -49,7 +50,7 @@ class ApplicationController < ActionController::Base
     if @object.update_attributes attrs_to_update
       show
     else
-      render_error "Update failed"
+      raise "Update failed"
     end
   end
 
@@ -87,7 +88,9 @@ class ApplicationController < ActionController::Base
 
   def render_error(e)
     logger.error e.inspect
-    logger.error e.backtrace.collect { |x| x + "\n" }.join('') if e.backtrace
+    if e.respond_to? :backtrace and e.backtrace
+      logger.error e.backtrace.collect { |x| x + "\n" }.join('')
+    end
     if @object and @object.errors and @object.errors.full_messages and not @object.errors.full_messages.empty?
       errors = @object.errors.full_messages
     else
@@ -111,16 +114,65 @@ class ApplicationController < ActionController::Base
       @where = params[:where]
     elsif params[:where].is_a? String
       begin
-        @where = Oj.load(params[:where], symbol_keys: true)
+        @where = Oj.load(params[:where])
+        raise unless @where.is_a? Hash
       rescue
         raise ArgumentError.new("Could not parse \"where\" param as an object")
       end
     end
+    @where = @where.with_indifferent_access
+  end
+
+  def load_filters_param
+    if params[:filters].is_a? Array
+      @filters = params[:filters]
+    elsif params[:filters].is_a? String and !params[:filters].empty?
+      begin
+        @filters = Oj.load params[:filters]
+        raise unless @filters.is_a? Array
+      rescue
+        raise ArgumentError.new("Could not parse \"filters\" param as an array")
+      end
+    end
   end
 
   def find_objects_for_index
     @objects ||= model_class.readable_by(current_user)
-    if !@where.empty?
+    apply_where_limit_order_params
+  end
+
+  def apply_where_limit_order_params
+    if @filters.is_a? Array and @filters.any?
+      cond_out = []
+      param_out = []
+      @filters.each do |attr, operator, operand|
+        if !model_class.searchable_columns.index attr.to_s
+          raise ArgumentError.new("Invalid attribute '#{attr}' in condition")
+        end
+        case operator.downcase
+        when '=', '<', '<=', '>', '>=', 'like'
+          if operand.is_a? String
+            cond_out << "#{table_name}.#{attr} #{operator} ?"
+            if (# any operator that operates on value rather than
+                # representation:
+                operator.match(/[<=>]/) and
+                model_class.attribute_column(attr).type == :datetime)
+              operand = Time.parse operand
+            end
+            param_out << operand
+          end
+        when 'in'
+          if operand.is_a? Array
+            cond_out << "#{table_name}.#{attr} IN (?)"
+            param_out << operand
+          end
+        end
+      end
+      if cond_out.any?
+        @objects = @objects.where(cond_out.join(' AND '), *param_out)
+      end
+    end
+    if @where.is_a? Hash and @where.any?
       conditions = ['1=1']
       @where.each do |attr,value|
         if attr == :any
@@ -170,15 +222,31 @@ class ApplicationController < ActionController::Base
           where(*conditions)
       end
     end
+
     if params[:limit]
       begin
-        @objects = @objects.limit(params[:limit].to_i)
+        @limit = params[:limit].to_i
       rescue
         raise ArgumentError.new("Invalid value for limit parameter")
       end
     else
-      @objects = @objects.limit(100)
+      @limit = 100
     end
+    @objects = @objects.limit(@limit)
+
+    orders = []
+
+    if params[:offset]
+      begin
+        @objects = @objects.offset(params[:offset].to_i)
+        @offset = params[:offset].to_i
+      rescue
+        raise ArgumentError.new("Invalid value for limit parameter")
+      end
+    else
+      @offset = 0
+    end      
+
     orders = []
     if params[:order]
       params[:order].split(',').each do |order|
@@ -265,7 +333,7 @@ class ApplicationController < ActionController::Base
       if supplied_token
         api_client_auth = ApiClientAuthorization.
           includes(:api_client, :user).
-          where('api_token=? and (expires_at is null or expires_at > now())', supplied_token).
+          where('api_token=? and (expires_at is null or expires_at > CURRENT_TIMESTAMP)', supplied_token).
           first
         if api_client_auth.andand.user
           session[:user_id] = api_client_auth.user.id
@@ -361,12 +429,12 @@ class ApplicationController < ActionController::Base
       :kind  => "arvados##{(@response_resource_name || resource_name).camelize(:lower)}List",
       :etag => "",
       :self_link => "",
-      :next_page_token => "",
-      :next_link => "",
+      :offset => @offset,
+      :limit => @limit,
       :items => @objects.as_api_response(nil)
     }
     if @objects.respond_to? :except
-      @object_list[:items_available] = @objects.except(:limit).count
+      @object_list[:items_available] = @objects.except(:limit).except(:offset).count
     end
     render json: @object_list
   end
@@ -384,6 +452,7 @@ class ApplicationController < ActionController::Base
 
   def self._index_requires_parameters
     {
+      filters: { type: 'array', required: false },
       where: { type: 'object', required: false },
       order: { type: 'string', required: false }
     }
@@ -395,13 +464,15 @@ class ApplicationController < ActionController::Base
   end
 
   def render *opts
-    response = opts.first[:json]
-    if response.is_a?(Hash) &&
-        params[:_profile] &&
-        Thread.current[:request_starttime]
-      response[:_profile] = {
-         request_time: Time.now - Thread.current[:request_starttime]
-      }
+    if opts.first
+      response = opts.first[:json]
+      if response.is_a?(Hash) &&
+          params[:_profile] &&
+          Thread.current[:request_starttime]
+        response[:_profile] = {
+          request_time: Time.now - Thread.current[:request_starttime]
+        }
+      end
     end
     super *opts
   end
index 5c2f5db6cf9683a3b2f6b0904381c42c6e4ddd49..b7b0e677d63d5b5d2e5389a27a42ab1f709f34ad 100644 (file)
@@ -6,6 +6,7 @@ class Arvados::V1::JobsController < ApplicationController
   skip_before_filter :render_404_if_no_object, :only => :queue
 
   def index
+    return super unless @where.is_a? Hash
     want_ancestor = @where[:script_version_descends_from]
     if want_ancestor
       # Check for missing commit_ancestor rows, and create them if
@@ -144,7 +145,8 @@ class Arvados::V1::JobsController < ApplicationController
     @where.merge!({
                     started_at: nil,
                     is_locked_by_uuid: nil,
-                    cancelled_at: nil
+                    cancelled_at: nil,
+                    success: nil
                   })
     params[:order] ||= 'priority desc, created_at'
     find_objects_for_index
index 7df2edb49fff38213ac5eb6a8d1a3a3b36298742..d2b82c1ab2a1a05801a6ce694d69b1c5175a992c 100644 (file)
@@ -1,29 +1,10 @@
 class Arvados::V1::SchemaController < ApplicationController
+  skip_before_filter :find_objects_for_index
   skip_before_filter :find_object_by_uuid
   skip_before_filter :render_404_if_no_object
   skip_before_filter :require_auth_scope_all
 
-  def show
-    classes = Rails.cache.fetch 'arvados_v1_schema' do
-      Rails.application.eager_load!
-      classes = {}
-      ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |k|
-        classes[k] = k.columns.collect do |col|
-          if k.serialized_attributes.has_key? col.name
-            { name: col.name,
-              type: k.serialized_attributes[col.name].object_class.to_s }
-          else
-            { name: col.name,
-              type: col.type }
-          end
-        end
-      end
-      classes
-    end
-    render json: classes
-  end
-
-  def discovery_rest_description
+  def index
     expires_in 24.hours, public: true
     discovery = Rails.cache.fetch 'arvados_v1_rest_discovery' do
       Rails.application.eager_load!
@@ -222,9 +203,22 @@ class Arvados::V1::SchemaController < ApplicationController
                   minimum: 0,
                   location: "query",
                 },
+                offset: {
+                  type: "integer",
+                  description: "Number of #{k.to_s.underscore.pluralize} to skip before first returned record.",
+                  default: 0,
+                  format: "int32",
+                  minimum: 0,
+                  location: "query",
+                  },
+                filters: {
+                  type: "array",
+                  description: "Conditions for filtering #{k.to_s.underscore.pluralize}.",
+                  location: "query"
+                },
                 where: {
                   type: "object",
-                  description: "Conditions for filtering #{k.to_s.underscore.pluralize}.",
+                  description: "Conditions for filtering #{k.to_s.underscore.pluralize}. (Deprecated. Use filters instead.)",
                   location: "query"
                 },
                 order: {
@@ -323,7 +317,8 @@ class Arvados::V1::SchemaController < ApplicationController
           if httpMethod and
               route.defaults[:controller] == 'arvados/v1/' + k.to_s.underscore.pluralize and
               !d_methods[action.to_sym] and
-              ctl_class.action_methods.include? action
+              ctl_class.action_methods.include? action and
+              ![:show, :index, :destroy].include?(action.to_sym)
             method = {
               id: "arvados.#{k.to_s.underscore.pluralize}.#{action}",
               path: route.path.spec.to_s.sub('/arvados/v1/','').sub('(.:format)','').sub(/:(uu)?id/,'{uuid}'),
index 133df0f62c17125ead845cbb64331b3cb79290a2..5fc827352bc450a87b960ba70b807daae0959d1d 100644 (file)
@@ -1,8 +1,8 @@
 class Arvados::V1::UsersController < ApplicationController
   skip_before_filter :find_object_by_uuid, only:
-    [:activate, :event_stream, :current, :system]
+    [:activate, :event_stream, :current, :system, :setup]
   skip_before_filter :render_404_if_no_object, only:
-    [:activate, :event_stream, :current, :system]
+    [:activate, :event_stream, :current, :system, :setup]
 
   def current
     @object = current_user
@@ -87,4 +87,49 @@ class Arvados::V1::UsersController < ApplicationController
     end
     show
   end
+
+  # create user object and all the needed links
+  def setup
+    @object = nil
+    if params[:uuid]
+      @object = User.find_by_uuid params[:uuid]
+      if !@object
+        return render_404_if_no_object
+      end
+      object_found = true
+    else
+      if !params[:user]
+        raise ArgumentError.new "Required uuid or user"
+      else
+        if params[:user]['uuid']
+          @object = User.find_by_uuid params[:user]['uuid']
+          if @object
+            object_found = true
+          end
+        end
+
+        if !@object
+          if !params[:user]['email']
+            raise ArgumentError.new "Require user email"
+          end
+
+          if !params[:openid_prefix]
+            raise ArgumentError.new "Required openid_prefix parameter is missing."
+          end
+
+          @object = model_class.create! resource_attrs
+        end
+      end
+    end
+
+    if object_found
+      @response = @object.setup_repo_vm_links params[:repo_name], params[:vm_uuid]
+    else
+      @response = User.setup @object, params[:openid_prefix],
+                    params[:repo_name], params[:vm_uuid]
+    end
+
+    render json: { kind: "arvados#HashList", items: @response }
+  end
+
 end
index 71c2823dc15ee7a4aae33984e66beda351ee2481..3674c010cb7bcd97ae808483997ef5118554042f 100644 (file)
@@ -121,7 +121,8 @@ class UserSessionsController < ApplicationController
     api_client_auth = ApiClientAuthorization.
       new(user: user,
           api_client: @api_client,
-          created_by_ip_address: remote_ip)
+          created_by_ip_address: remote_ip,
+          scopes: ["all"])
     api_client_auth.save!
 
     if callback_url.index('?')
index c89efdf404abb3a0f7f9a374562851b57abe372d..8e37898648c9721765bafee733c0229c7bd5b11e 100644 (file)
@@ -40,12 +40,16 @@ class ArvadosModel < ActiveRecord::Base
 
   def self.searchable_columns
     self.columns.collect do |col|
-      if [:string, :text].index(col.type) && col.name != 'owner_uuid'
+      if [:string, :text, :datetime, :integer].index(col.type) && col.name != 'owner_uuid'
         col.name
       end
     end.compact
   end
 
+  def self.attribute_column attr
+    self.columns.select { |col| col.name == attr.to_s }.first
+  end
+
   def eager_load_associations
     self.class.columns.each do |col|
       re = col.name.match /^(.*)_kind$/
index 9c8f724120ba8049b4a498141e669c5708ca0317..1f0ef758d97a893664e9e82fb9131b90de688995 100644 (file)
@@ -51,8 +51,8 @@ class Job < ArvadosModel
   end
 
   def self.queue
-    self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ?',
-               nil, nil, nil).
+    self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ? and success is ?',
+               nil, nil, nil, nil).
       order('priority desc, created_at')
   end
 
@@ -108,7 +108,8 @@ class Job < ArvadosModel
 
   def permission_to_update
     if is_locked_by_uuid_was and !(current_user and
-                                   current_user.uuid == is_locked_by_uuid_was)
+                                   (current_user.uuid == is_locked_by_uuid_was or
+                                    current_user.uuid == system_user.uuid))
       if script_changed? or
           script_parameters_changed? or
           script_version_changed? or
index a85a63df7d8d579ff94f1a8d830e4ebd1289a8dc..563bb0717002f4a68c8b2892cfa4b6cfd6714bd9 100644 (file)
@@ -109,6 +109,42 @@ class User < ArvadosModel
     end
   end
 
+  def self.setup(user, openid_prefix, repo_name=nil, vm_uuid=nil)
+    login_perm_props = {identity_url_prefix: openid_prefix}
+
+    # Check oid_login_perm
+    oid_login_perms = Link.where(tail_uuid: user.email,
+                                   head_kind: 'arvados#user',
+                                   link_class: 'permission',
+                                   name: 'can_login')
+
+    if !oid_login_perms.any?
+      # create openid login permission
+      oid_login_perm = Link.create(link_class: 'permission',
+                                   name: 'can_login',
+                                   tail_kind: 'email',
+                                   tail_uuid: user.email,
+                                   head_kind: 'arvados#user',
+                                   head_uuid: user.uuid,
+                                   properties: login_perm_props
+                                  )
+      logger.info { "openid login permission: " + oid_login_perm[:uuid] }
+    else
+      oid_login_perm = oid_login_perms.first
+    end
+
+    return [oid_login_perm] + user.setup_repo_vm_links(repo_name, vm_uuid)
+  end 
+
+  # create links
+  def setup_repo_vm_links(repo_name, vm_uuid)
+    repo_perm = create_user_repo_link repo_name
+    vm_login_perm = create_vm_login_permission_link vm_uuid, repo_name
+    group_perm = create_user_group_link
+
+    return [repo_perm, vm_login_perm, group_perm, self].compact
+  end 
+
   protected
 
   def permission_to_update
@@ -124,7 +160,7 @@ class User < ArvadosModel
   end
 
   def check_auto_admin
-    if User.where("uuid not like '%-000000000000000'").where(:is_admin => true).count == 0 and not Rails.configuration.auto_admin_user.nil?
+    if User.where("uuid not like '%-000000000000000'").where(:is_admin => true).count == 0 and Rails.configuration.auto_admin_user
       if current_user.email == Rails.configuration.auto_admin_user
         self.is_admin = true
         self.is_active = true
@@ -177,4 +213,120 @@ class User < ArvadosModel
     upstream_path.delete start
     merged
   end
+
+  def create_user_repo_link(repo_name)
+    # repo_name is optional
+    if not repo_name
+      logger.warn ("Repository name not given for #{self.uuid}.")
+      return
+    end
+
+    # Check for an existing repository with the same name we're about to use.
+    repo = Repository.where(name: repo_name).first
+
+    if repo
+      logger.warn "Repository exists for #{repo_name}: #{repo[:uuid]}."
+
+      # Look for existing repository access for this repo
+      repo_perms = Link.where(tail_uuid: self.uuid,
+                              head_kind: 'arvados#repository',
+                              head_uuid: repo[:uuid],
+                              link_class: 'permission',
+                              name: 'can_write')
+      if repo_perms.any?
+        logger.warn "User already has repository access " + 
+            repo_perms.collect { |p| p[:uuid] }.inspect
+        return repo_perms.first
+      end
+    end
+
+    # create repo, if does not already exist
+    repo ||= Repository.create(name: repo_name)
+    logger.info { "repo uuid: " + repo[:uuid] }
+
+    repo_perm = Link.create(tail_kind: 'arvados#user',
+                            tail_uuid: self.uuid,
+                            head_kind: 'arvados#repository',
+                            head_uuid: repo[:uuid],
+                            link_class: 'permission',
+                            name: 'can_write')
+    logger.info { "repo permission: " + repo_perm[:uuid] }
+    return repo_perm
+  end
+
+  # create login permission for the given vm_uuid, if it does not already exist
+  def create_vm_login_permission_link(vm_uuid, repo_name)
+    begin
+              
+      # vm uuid is optional
+      if vm_uuid 
+        vm = VirtualMachine.where(uuid: vm_uuid).first
+
+        if not vm
+          logger.warn "Could not find virtual machine for #{vm_uuid.inspect}"
+          raise "No vm found for #{vm_uuid}"
+        end
+      else
+        return 
+      end
+
+      logger.info { "vm uuid: " + vm[:uuid] }
+
+      login_perms = Link.where(tail_uuid: self.uuid,
+                              head_uuid: vm[:uuid],
+                              head_kind: 'arvados#virtualMachine',
+                              link_class: 'permission',
+                              name: 'can_login')
+      if !login_perms.any?
+        login_perm = Link.create(tail_kind: 'arvados#user',
+                                 tail_uuid: self.uuid,
+                                 head_kind: 'arvados#virtualMachine',
+                                 head_uuid: vm[:uuid],
+                                 link_class: 'permission',
+                                 name: 'can_login',
+                                 properties: {username: repo_name})
+        logger.info { "login permission: " + login_perm[:uuid] }
+      else
+        login_perm = login_perms.first
+      end
+
+      return login_perm
+    end
+  end
+
+  # add the user to the 'All users' group
+  def create_user_group_link
+    # Look up the "All users" group (we expect uuid *-*-fffffffffffffff).
+    group = Group.where(name: 'All users').select do |g|
+      g[:uuid].match /-f+$/
+    end.first
+
+    if not group
+      logger.warn "No 'All users' group with uuid '*-*-fffffffffffffff'."
+      raise "No 'All users' group with uuid '*-*-fffffffffffffff' is found"
+    else
+      logger.info { "\"All users\" group uuid: " + group[:uuid] }
+
+      group_perms = Link.where(tail_uuid: self.uuid,
+                              head_uuid: group[:uuid],
+                              head_kind: 'arvados#group',
+                              link_class: 'permission',
+                              name: 'can_read')
+
+      if !group_perms.any?
+        group_perm = Link.create(tail_kind: 'arvados#user',
+                                 tail_uuid: self.uuid,
+                                 head_kind: 'arvados#group',
+                                 head_uuid: group[:uuid],
+                                 link_class: 'permission',
+                                 name: 'can_read')
+        logger.info { "group permission: " + group_perm[:uuid] }
+      else 
+        group_perm = group_perms.first
+      end
+
+      return group_perm
+    end
+  end
+
 end
index 36eedb4fceec8fb264613f39289043b5d1696170..e46ff5dd187c2777060d1bd9dba16132e875cfa9 100644 (file)
@@ -39,6 +39,7 @@ test:
   action_mailer.delivery_method: :test
   active_support.deprecation: :stderr
   active_record.mass_assignment_sanitizer: :strict
+  uuid_prefix: zzzzz
 
 common:
   secret_token: ~
@@ -64,7 +65,7 @@ common:
   compute_node_ec2run_args: -g arvados-compute
   compute_node_spot_bid: 0.11
 
-  compute_node_domain: <%= `hostname`.split('.')[1..-1].join('.').strip %>
+  compute_node_domain: false
   compute_node_nameservers:
     - 192.168.1.1
   compute_node_ec2_tag_enable: false
@@ -83,4 +84,18 @@ common:
   # In the default configuration, authentication happens through the Arvados SSO
   # server, which uses openid against Google's servers, so in that case this
   # should be an address associated with a Google account.
-  auto_admin_user: ~
+  auto_admin_user: false
+
+  ## Set Time.zone default to the specified zone and make Active
+  ## Record auto-convert to this zone.  Run "rake -D time" for a list
+  ## of tasks for finding time zone names. Default is UTC.
+  #time_zone: Central Time (US & Canada)
+
+  ## Default encoding used in templates for Ruby 1.9.
+  encoding: utf-8
+
+  # Enable the asset pipeline
+  assets.enabled: true
+
+  # Version of your assets, change this if you want to expire all your assets
+  assets.version: "1.0"
index 2f331eeffa2462088a00a6957f3c3532bf67e150..24648a9a58d3de8904a59f11f6de4a27d82a9f10 100644 (file)
@@ -26,37 +26,11 @@ module Server
     # Activate observers that should always be running.
     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
 
-    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
-    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
-    # config.time_zone = 'Central Time (US & Canada)'
-
     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
     # config.i18n.default_locale = :de
 
-    # Configure the default encoding used in templates for Ruby 1.9.
-    config.encoding = "utf-8"
-
     # Configure sensitive parameters which will be filtered from the log file.
     config.filter_parameters += [:password]
-
-    # Enable the asset pipeline
-    config.assets.enabled = true
-
-    # Version of your assets, change this if you want to expire all your assets
-    config.assets.version = '1.0'
-
-    config.force_ssl = true
-
-    def config.uuid_prefix(x=nil)
-      if x and @uuid_prefix
-        raise "uuid_prefix was already set to #{@uuid_prefix}"
-      end
-      @uuid_prefix ||= Digest::MD5.hexdigest(x || `hostname`.strip).to_i(16).to_s(36)[-5..-1]
-    end
-    def config.uuid_prefix=(x)
-      @uuid_prefix = x
-    end
   end
-
 end
index dcfcb42f186404df4b42da0fb1f318dd7f70e501..488c4bd3e6cff843ecac18f3a4142ca99d2182cf 100644 (file)
@@ -18,24 +18,29 @@ production:
 
   uuid_prefix: bogus
 
-  # This is suitable for AWS; see common section below for a static example.
-  compute_node_nameservers: <%=
+  # compute_node_domain: example.org
+  # compute_node_nameservers:
+  #   - 127.0.0.1
+  #   - 192.168.1.1
+  #
+  # The version below is suitable for AWS.
+  # Uncomment and change <%# to <%= to use it.
+  # compute_node_nameservers: <%#
     require 'net/http'
     ['local', 'public'].collect do |iface|
       Net::HTTP.get(URI("http://169.254.169.254/latest/meta-data/#{iface}-ipv4")).match(/^[\d\.]+$/)[0]
     end << '172.16.0.23'
   %>
-  # You must customize these. See config.defaults.yml for information.
-  compute_node_ami: ~
-  compute_node_ec2_tag_enable: ~
-  compute_node_domain: ~
-  compute_node_spot_bid: ~
 
 test:
   uuid_prefix: zzzzz
+  secret_token: <%= rand(2**512).to_s(36) %>
 
 common:
-  secret_token: ~
-  compute_node_nameservers:
-    - 192.168.0.1
-    - 172.16.0.1
+
+  # Git repositories must be readable by api server, or you won't be
+  # able to submit crunch jobs. To pass the test suites, put a clone
+  # of the arvados tree in {git_repositories_dir}/arvados.git or
+  # {git_repositories_dir}/arvados/.git
+  #
+  #git_repositories_dir: /var/cache/git
index 8f54e6630987377588d8ce0e00a2e59a3434b351..25fcc7ada79ba516073a6c206699b26792d1b6f7 100644 (file)
@@ -1,10 +1,6 @@
 development:
-  adapter: postgresql
-  encoding: utf8
-  database: arvados_development
-  username: arvados
-  password: ********
-  host: localhost
+  adapter: sqlite3
+  database: db/arvados_development.sqlite3
 
 test:
   adapter: postgresql
index dc33dce7cd74115ff383daef3f94667fd39fa64e..b6c4c92871b8c3616993dfa553831b568b7ae577 100644 (file)
@@ -38,43 +38,4 @@ Server::Application.configure do
 
   config.force_ssl = false
 
-  config.git_repositories_dir = '/var/cache/git'
-
-  config.crunch_job_wrapper = :none
-  config.crunch_job_user = 'crunch' # if false, do not set uid when running jobs
-
-  # The web service must be able to create/write this file, and
-  # crunch-job must be able to stat() it.
-  config.crunch_refresh_trigger = '/tmp/crunch_refresh_trigger'
-
-  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
-
-  # config.compute_node_ami = 'ami-cbca41a2'
-  # config.compute_node_ec2run_args = '-g arvados-compute'
-  # config.compute_node_spot_bid = 0.11
-
-  # config.compute_node_domain = `hostname --domain`.strip
-
-  # config.compute_node_nameservers = ['1.2.3.4', '1.2.3.5']
-  config.compute_node_nameservers = ['192.168.201.3']
-
-  config.uuid_prefix('development@' + `hostname`.strip)
-
-  # Authentication stub: hard code pre-approved API tokens.
-  # config.accept_api_token = { rand(2**256).to_s(36) => true }
-  config.accept_api_token = {}
-
-  config.new_users_are_active = false
-  config.admin_notifier_email_from = 'arvados@example.com'
-  config.email_subject_prefix = '[ARVADOS] '
-
-  # Visitors to the API server will be redirected to the workbench
-  config.workbench_address = "http://localhost:3000/"
-
-  # The e-mail address of the user you would like to become marked as an admin
-  # user on their first login.
-  # In the default configuration, authentication happens through the Arvados SSO
-  # server, which uses openid against Google's servers, so in that case this
-  # should be an address associated with a Google account.
-  config.auto_admin_user = ''
 end
index 357dd6013b42593fc4129094b874483067af0384..ac6ce1b8ed87473aae9bb1e0dba9b23affebc655 100644 (file)
@@ -60,46 +60,4 @@ Server::Application.configure do
   # Send deprecation notices to registered listeners
   config.active_support.deprecation = :notify
 
-  config.git_repositories_dir = '/var/cache/git'
-
-  config.crunch_job_wrapper = :slurm_immediate
-  config.crunch_job_user = 'crunch' # if false, do not set uid when running jobs
-
-  # The web service must be able to create/write this file, and
-  # crunch-job must be able to stat() it.
-  config.crunch_refresh_trigger = '/tmp/crunch_refresh_trigger'
-
-  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
-
-  # config.compute_node_ami = 'ami-cbca41a2'
-  # config.compute_node_ec2run_args = '-g arvados-compute'
-  # config.compute_node_spot_bid = 0.11
-
-  # config.compute_node_domain = `hostname --domain`.strip
-
-  # config.compute_node_nameservers = ['1.2.3.4', '1.2.3.5']
-  require 'net/http'
-  config.compute_node_nameservers = ['local', 'public'].collect do |iface|
-    Net::HTTP.get(URI("http://169.254.169.254/latest/meta-data/#{iface}-ipv4")).match(/^[\d\.]+$/)[0]
-  end << '172.16.0.23'
-
-  config.uuid_prefix = Digest::MD5.hexdigest('cfi-aws-0').to_i(16).to_s(36)[0..4] # '9ujm1'
-
-  # Authentication stub: hard code pre-approved API tokens.
-  # config.accept_api_token = { rand(2**256).to_s(36) => true }
-  config.accept_api_token = {}
-
-  config.new_users_are_active = false
-  config.admin_notifier_email_from = 'arvados@example.com'
-  config.email_subject_prefix = '[ARVADOS] '
-
-  # Visitors to the API server will be redirected to the workbench
-  config.workbench_address = "http://workbench." + `hostname`
-
-  # The e-mail address of the user you would like to become marked as an admin
-  # user on their first login.
-  # In the default configuration, authentication happens through the Arvados SSO
-  # server, which uses openid against Google's servers, so in that case this
-  # should be an address associated with a Google account.
-  config.auto_admin_user = ''
 end
index 10608c15e356fdbede112a7f523db26dedd8db09..ae6234e38a2484d5987136c3b07bc1430ff399eb 100644 (file)
@@ -40,47 +40,7 @@ Server::Application.configure do
   # Raise exception on mass assignment protection for Active Record models
   config.active_record.mass_assignment_sanitizer = :strict
 
-  config.git_repositories_dir = '/var/cache/git'
-
-  config.crunch_job_wrapper = :slurm_immediate
-  config.crunch_job_user = 'crunch' # if false, do not set uid when running jobs
-
-  # The web service must be able to create/write this file, and
-  # crunch-job must be able to stat() it.
-  config.crunch_refresh_trigger = '/tmp/crunch_refresh_trigger_test'
-
-  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
-
-  # config.compute_node_ami = 'ami-cbca41a2'
-  # config.compute_node_ec2run_args = '-g arvados-compute'
-  # config.compute_node_spot_bid = 0.11
-  config.compute_node_ec2_tag_enable = false
-
-  # config.compute_node_domain = `hostname --domain`.strip
-
   # No need for SSL while testing
   config.force_ssl = false
 
-  # config.compute_node_nameservers = ['1.2.3.4', '1.2.3.5']
-  config.compute_node_nameservers = [ "172.16.0.23" ]
-
-  config.uuid_prefix = 'zzzzz'
-
-  # Authentication stub: hard code pre-approved API tokens.
-  # config.accept_api_token = { rand(2**256).to_s(36) => true }
-  config.accept_api_token = {}
-
-  config.new_users_are_active = false
-  config.admin_notifier_email_from = 'arvados@example.com'
-  config.email_subject_prefix = '[ARVADOS] '
-
-  # Visitors to the API server will be redirected to the workbench
-  config.workbench_address = "http://localhost:3000/"
-
-  # The e-mail address of the user you would like to become marked as an admin
-  # user on their first login.
-  # In the default configuration, authentication happens through the Arvados SSO
-  # server, which uses openid against Google's servers, so in that case this
-  # should be an address associated with a Google account.
-  config.auto_admin_user = ''
 end
index cd25374a75fe2bcae403734ae1bff84bef25b4cb..aefcf56625b90e3f3410dbcb4e8f3d4999244719 100644 (file)
@@ -4,7 +4,7 @@ APP_ID = 'arvados-server'
 APP_SECRET = rand(2**512).to_s(36) # CHANGE ME!
 
 # Update your custom Omniauth provider URL here
-CUSTOM_PROVIDER_URL = 'http://auth.clinicalfuture.com'
+CUSTOM_PROVIDER_URL = 'http://localhost:3002'
 
 Rails.application.config.middleware.use OmniAuth::Builder do
   provider :josh_id, APP_ID, APP_SECRET, CUSTOM_PROVIDER_URL
index dffae7fad1725768af1e00b1fbb37ac60da9f650..2b92a7b481d19da802e8377ebe53c0c99137ba7d 100644 (file)
@@ -79,7 +79,6 @@ Server::Application.routes.draw do
 
   namespace :arvados do
     namespace :v1 do
-      match '/schema' => 'schema#show'
       match '/nodes/:uuid/ping' => 'nodes#ping', :as => :ping_node
       match '/keep_disks/ping' => 'keep_disks#ping', :as => :ping_keep_disk
       match '/links/from/:tail_uuid' => 'links#index', :as => :arvados_v1_links_from
@@ -90,6 +89,7 @@ Server::Application.routes.draw do
       post '/jobs/:uuid/cancel' => 'jobs#cancel'
       match '/users/:uuid/event_stream' => 'users#event_stream'
       post '/users/:uuid/activate' => 'users#activate'
+      post '/users/setup' => 'users#setup'
       match '/virtual_machines/get_all_logins' => 'virtual_machines#get_all_logins'
       match '/virtual_machines/:uuid/logins' => 'virtual_machines#logins'
       post '/api_client_authorizations/create_system_auth' => 'api_client_authorizations#create_system_auth'
@@ -129,7 +129,7 @@ Server::Application.routes.draw do
   match '/login', :to => 'user_sessions#login'
   match '/logout', :to => 'user_sessions#logout'
 
-  match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#discovery_rest_description'
+  match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#index'
 
   match '/static/login_failure', :to => 'static#login_failure', :as => :login_failure
 
index c9f12fc1a929d775104dedcce23d8e63f383dc45..ec1ae7bdc478a08cc172eca7c30ffd7eecda1cba 100644 (file)
@@ -2,7 +2,18 @@ namespace :config do
   desc 'Ensure site configuration has all required settings'
   task check: :environment do
     $application_config.sort.each do |k, v|
-      $stderr.puts "%-32s %s" % [k, eval("Rails.configuration.#{k}")]
+      if ENV.has_key?('QUIET') then
+        # Make sure we still check for the variable to exist
+        eval("Rails.configuration.#{k}")
+      else
+        if /(password|secret)/.match(k) then
+          # Make sure we still check for the variable to exist, but don't print the value
+          eval("Rails.configuration.#{k}")
+          $stderr.puts "%-32s %s" % [k, '*********']
+        else
+          $stderr.puts "%-32s %s" % [k, eval("Rails.configuration.#{k}")]
+        end
+      end
     end
   end
 end
index 693dfbdb7fc049289067d94e866b48049bc8c2cb..6df9a19d299a5a8a440a99866be774e0bbad9d4c 100755 (executable)
@@ -298,7 +298,6 @@ class Dispatcher
     job_done = j_done[:job]
     $stderr.puts "dispatch: child #{pid_done} exit"
     $stderr.puts "dispatch: job #{job_done.uuid} end"
-    $redis.publish job_done.uuid, "end"
 
     # Ensure every last drop of stdout and stderr is consumed
     read_pipes
@@ -309,9 +308,18 @@ class Dispatcher
     # Wait the thread
     j_done[:wait_thr].value
 
+    jobrecord = Job.find_by_uuid(job_done.uuid)
+    jobrecord.running = false
+    jobrecord.finished_at ||= Time.now
+    # Don't set 'jobrecord.success = false' because if the job failed to run due to an
+    # issue with crunch-job or slurm, we want the job to stay in the queue.
+    jobrecord.save!
+
     # Invalidate the per-job auth token
     j_done[:job_auth].update_attributes expires_at: Time.now
 
+    $redis.publish job_done.uuid, "end"
+
     @running.delete job_done.uuid
   end
 
@@ -360,8 +368,6 @@ class Dispatcher
     end
   end
 
-
-
   protected
 
   def did_recently(thing, min_interval)
index 88627f559de4d507b3fac87c53c4aab111a235ec..2167b0431882ef9eeef5acd733dc3b03312c6f34 100755 (executable)
@@ -21,10 +21,6 @@ module Rails
                 :config => File.expand_path("config.ru"),
                 :SSLEnable => true,
                 :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
-                :SSLPrivateKey => OpenSSL::PKey::RSA.new(
-                       File.open("config/api.clinicalfuture.com.key.pem").read),
-                :SSLCertificate => OpenSSL::X509::Certificate.new(
-                       File.open("config/api.clinicalfuture.com.crt.pem").read),
                 :SSLCertName => [["CN", WEBrick::Utils::getservername]]
             })
         end
diff --git a/services/api/script/setup-new-user.rb b/services/api/script/setup-new-user.rb
new file mode 100755 (executable)
index 0000000..19f5aeb
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/env ruby
+
+abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
+
+require 'logger'
+require 'trollop'
+
+log = Logger.new STDERR
+log.progname = $0.split('/').last
+
+opts = Trollop::options do
+  banner ''
+  banner "Usage: #{log.progname} " +
+    "{user_uuid_or_email} {user_and_repo_name} {vm_uuid}"
+  banner ''
+  opt :debug, <<-eos
+Show debug messages.
+  eos
+  opt :openid_prefix, <<-eos, default: 'https://www.google.com/accounts/o8/id'
+If creating a new user record, require authentication from an OpenID \
+with this OpenID prefix *and* a matching email address in order to \
+claim the account.
+  eos
+end
+
+log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN
+    
+if ARGV.count != 3
+  Trollop::die "required arguments are missing"
+end
+
+user_arg, user_repo_name, vm_uuid = ARGV
+
+require 'arvados'
+arv = Arvados.new(api_version: 'v1')
+
+# Look up the given user by uuid or, failing that, email address.
+begin
+  found_user = arv.user.get(uuid: user_arg)
+rescue Arvados::TransactionFailedError
+  found = arv.user.list(where: {email: user_arg})[:items]
+    
+  if found.count == 0 
+    if !user_arg.match(/\w\@\w+\.\w+/)
+      abort "About to create new user, but #{user_arg.inspect} " +
+               "does not look like an email address. Stop."
+    end
+  elsif found.count != 1
+    abort "Found #{found.count} users with email. Stop."
+  else
+    found_user = found.first
+  end
+end
+
+# Invoke user setup method
+if (found_user)
+  user = arv.user.setup uuid: found_user[:uuid], repo_name: user_repo_name,
+        vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix
+else
+  user = arv.user.setup user: {email: user_arg}, repo_name: user_repo_name,
+        vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix
+end
+
+log.info {"user uuid: " + user[:uuid]}
+
+puts user.inspect
index 78a627ad1a25ef27da3af63802938d6edb3d8567..575eda3d929204beb23f54b0aef0710e51be44a2 100644 (file)
@@ -9,6 +9,28 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     assert_not_nil assigns(:objects)
   end
 
+  [0,1,2].each do |limit|
+    test "get index with limit=#{limit}" do
+      authorize_with :active
+      get :index, limit: limit
+      assert_response :success
+      assert_equal limit, assigns(:objects).count
+      resp = JSON.parse(@response.body)
+      assert_equal limit, resp['limit']
+    end
+  end
+
+  test "get index with limit=2 offset=99999" do
+    # Assume there are not that many test fixtures.
+    authorize_with :active
+    get :index, limit: 2, offset: 99999
+    assert_response :success
+    assert_equal 0, assigns(:objects).count
+    resp = JSON.parse(@response.body)
+    assert_equal 2, resp['limit']
+    assert_equal 99999, resp['offset']
+  end
+
   test "should create" do
     authorize_with :active
     test_collection = {
index 95bbf529db77d8b97a4e6135f115889aa63aeb5c..f68cbc2dd2467281872adf45cea3bc72a53f6432 100644 (file)
@@ -103,4 +103,127 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     }
     assert_response :success
   end
+
+  test "search jobs by uuid with >= query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+    assert_equal false, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+  end
+
+  test "search jobs by uuid with <= query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+    assert_equal true, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+  end
+
+  test "search jobs by uuid with >= and <= query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', '>=', 'zzzzz-8i9sb-pshmckwoma9plh7'],
+              ['uuid', '<=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal found, ['zzzzz-8i9sb-pshmckwoma9plh7']
+  end
+
+  test "search jobs by uuid with < query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', '<', 'zzzzz-8i9sb-pshmckwoma9plh7']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal false, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+    assert_equal true, !!found.index('zzzzz-8i9sb-4cf0nhn6xte809j')
+  end
+
+  test "search jobs by uuid with like query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', 'like', '%hmckwoma9pl%']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal found, ['zzzzz-8i9sb-pshmckwoma9plh7']
+  end
+
+  test "search jobs by uuid with 'in' query" do
+    authorize_with :active
+    get :index, {
+      filters: [['uuid', 'in', ['zzzzz-8i9sb-4cf0nhn6xte809j',
+                                'zzzzz-8i9sb-pshmckwoma9plh7']]]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal found.sort, ['zzzzz-8i9sb-4cf0nhn6xte809j',
+                              'zzzzz-8i9sb-pshmckwoma9plh7']
+  end
+
+  test "search jobs by started_at with < query" do
+    authorize_with :active
+    get :index, {
+      filters: [['started_at', '<', Time.now.to_s]]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+  end
+
+  test "search jobs by started_at with > query" do
+    authorize_with :active
+    get :index, {
+      filters: [['started_at', '>', Time.now.to_s]]
+    }
+    assert_response :success
+    assert_equal 0, assigns(:objects).count
+  end
+
+  test "search jobs by started_at with >= query on metric date" do
+    authorize_with :active
+    get :index, {
+      filters: [['started_at', '>=', '2014-01-01']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+  end
+
+  test "search jobs by started_at with >= query on metric date and time" do
+    authorize_with :active
+    get :index, {
+      filters: [['started_at', '>=', '2014-01-01 01:23:45']]
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+  end
+
+  test "search jobs with 'any' operator" do
+    authorize_with :active
+    get :index, {
+      where: { any: ['contains', 'pshmckw'] }
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-8i9sb-pshmckwoma9plh7')
+  end
+
+  test "search jobs by nonexistent column with < query" do
+    authorize_with :active
+    get :index, {
+      filters: [['is_borked', '<', 'fizzbuzz']]
+    }
+    assert_response 422
+  end
 end
index 3ccfa055e705dd03ff80dc694d798db24fe76efc..385710e060c94796cdcecfa634ae1631870b73ab 100644 (file)
@@ -94,4 +94,32 @@ class Arvados::V1::KeepDisksControllerTest < ActionController::TestCase
     end
   end
 
+  test "search keep_disks by service_port with >= query" do
+    authorize_with :active
+    get :index, {
+      filters: [['service_port', '>=', 25107]]
+    }
+    assert_response :success
+    assert_equal true, assigns(:objects).any?
+  end
+
+  test "search keep_disks by service_port with < query" do
+    authorize_with :active
+    get :index, {
+      filters: [['service_port', '<', 25107]]
+    }
+    assert_response :success
+    assert_equal false, assigns(:objects).any?
+  end
+
+  test "search keep_disks with 'any' operator" do
+    authorize_with :active
+    get :index, {
+      where: { any: ['contains', 'o2t1q5w'] }
+    }
+    assert_response :success
+    found = assigns(:objects).collect(&:uuid)
+    assert_equal true, !!found.index('zzzzz-penuu-5w2o2t1q5wy7fhn')
+  end
+
 end
index 71d49dd9da729ea2644411fafafc8be37aa8b0d0..816834b2071471611d4add36fee89124a8743ca8 100644 (file)
@@ -4,7 +4,7 @@ class Arvados::V1::SchemaControllerTest < ActionController::TestCase
 
   test "should get fresh discovery document" do
     MAX_SCHEMA_AGE = 60
-    get :discovery_rest_description
+    get :index
     assert_response :success
     discovery_doc = JSON.parse(@response.body)
     assert_equal 'discovery#restDescription', discovery_doc['kind']
index 6d129d898fc370d0f8b02d0276f7ecfbcf5fd082..f4ee0b64a2eacc44fe1df1417970d36fcfecf0b5 100644 (file)
@@ -2,6 +2,11 @@ require 'test_helper'
 
 class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
+  setup do
+    @all_links_at_start = Link.all
+    @vm_uuid = virtual_machines(:testvm).uuid
+  end
+
   test "activate a user after signing UA" do
     authorize_with :inactive_but_signed_user_agreement
     get :current
@@ -38,4 +43,644 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     assert_equal true, me['is_active']
   end
 
+  test "create new user with user as input" do
+    authorize_with :admin
+    post :create, user: {
+      first_name: "test_first_name",
+      last_name: "test_last_name",
+      email: "foo@example.com"
+    }
+    assert_response :success
+    created = JSON.parse(@response.body)
+    assert_equal 'test_first_name', created['first_name']
+    assert_not_nil created['uuid'], 'expected uuid for the newly created user'
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_nil created['identity_url'], 'expected no identity_url'
+  end
+
+  test "create user with user, vm and repo as input" do
+    authorize_with :admin
+    repo_name = 'test_repo'
+
+    post :setup, {
+      repo_name: repo_name,
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      user: {
+        uuid: "this_is_agreeable",        
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      }
+    }
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+
+    created = find_obj_in_resp response_items, 'User', nil
+    assert_equal 'in_create_test_first_name', created['first_name']
+    assert_not_nil created['uuid'], 'expected non-null uuid for the new user'
+    assert_equal 'this_is_agreeable', created['uuid']
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_nil created['identity_url'], 'expected no identity_url' 
+
+    # arvados#user, repo link and link add user to 'All users' group
+    verify_num_links @all_links_at_start, 3
+
+    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        repo_name, created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+
+    # invoke setup again with the same data
+    post :setup, {
+      repo_name: repo_name,
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      user: {
+        uuid: "this_is_agreeable",
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      }
+    }
+
+    response_items = JSON.parse(@response.body)['items']
+
+    created = find_obj_in_resp response_items, 'User', nil
+    assert_equal 'in_create_test_first_name', created['first_name']
+    assert_not_nil created['uuid'], 'expected non-null uuid for the new user'
+    assert_equal 'this_is_agreeable', created['uuid']
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_nil created['identity_url'], 'expected no identity_url'
+
+    # arvados#user, repo link and link add user to 'All users' group
+    verify_num_links @all_links_at_start, 4
+
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        repo_name, created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
+        @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
+  test "setup user with bogus uuid and expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      uuid: 'bogus_uuid',
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid
+    }
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'Path not found'), 'Expected 404'
+  end
+
+  test "setup user with bogus uuid in user and expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      user: {uuid: 'bogus_uuid'},
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'ArgumentError: Require user email'),
+      'Expected RuntimeError'
+  end
+
+  test "setup user with no uuid and user, expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'Required uuid or user'),
+        'Expected ArgumentError'
+  end
+
+  test "setup user with no uuid and email, expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      user: {},
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? '<ArgumentError: Require user email'),
+        'Expected ArgumentError'
+  end
+
+  test "invoke setup with existing uuid, vm and repo and verify links" do
+    authorize_with :inactive
+    get :current
+    assert_response :success
+    inactive_user = JSON.parse(@response.body)
+    
+    authorize_with :admin
+
+    post :setup, {
+      uuid: inactive_user['uuid'],
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    resp_obj = find_obj_in_resp response_items, 'User', nil
+
+    assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
+    assert_equal inactive_user['uuid'], resp_obj['uuid']
+    assert_equal inactive_user['email'], resp_obj['email'], 
+        'expecting inactive user email'
+
+    # expect repo and vm links
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        'test_repo', resp_obj['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
+        @vm_uuid, resp_obj['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
+  test "invoke setup with existing uuid in user, verify response" do
+    authorize_with :inactive
+    get :current
+    assert_response :success
+    inactive_user = JSON.parse(@response.body)
+    
+    authorize_with :admin
+
+    post :setup, {
+      user: {uuid: inactive_user['uuid']},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    resp_obj = find_obj_in_resp response_items, 'User', nil
+
+    assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
+    assert_equal inactive_user['uuid'], resp_obj['uuid']
+    assert_equal inactive_user['email'], resp_obj['email'], 
+        'expecting inactive user email'
+  end
+
+  test "invoke setup with existing uuid but different email, expect original email" do
+    authorize_with :inactive
+    get :current
+    assert_response :success
+    inactive_user = JSON.parse(@response.body)
+    
+    authorize_with :admin
+
+    post :setup, {
+      uuid: inactive_user['uuid'],
+      user: {email: 'junk_email'}
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    resp_obj = find_obj_in_resp response_items, 'User', nil
+
+    assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
+    assert_equal inactive_user['uuid'], resp_obj['uuid']
+    assert_equal inactive_user['email'], resp_obj['email'], 
+        'expecting inactive user email'
+  end
+
+  test "setup user with valid email and repo as input" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      user: {email: 'foo@example.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+    response_object = find_obj_in_resp response_items, 'User', nil
+    assert_not_nil response_object['uuid'], 'expected uuid for the new user'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+
+    # three extra links; login link, group link and repo link
+    verify_num_links @all_links_at_start, 3
+  end
+
+  test "setup user with fake vm and expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      vm_uuid: 'no_such_vm',
+      user: {email: 'foo@example.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? "No vm found for no_such_vm"), 
+          'Expected RuntimeError: No vm found for no_such_vm'
+  end
+
+  test "setup user with valid email, repo and real vm as input" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      vm_uuid: @vm_uuid,
+      user: {email: 'foo@example.com'}
+    }
+
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+    response_object = find_obj_in_resp response_items, 'User', nil
+    assert_not_nil response_object['uuid'], 'expected uuid for the new user'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+
+    # three extra links; login link, group link and repo link
+    verify_num_links @all_links_at_start, 4
+  end
+
+  test "setup user with valid email, no vm and repo as input" do
+    authorize_with :admin
+
+    post :setup, {
+      user: {email: 'foo@example.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    assert_response :success    
+    response_items = JSON.parse(@response.body)['items']
+    response_object = find_obj_in_resp response_items, 'User', nil
+    assert_not_nil response_object['uuid'], 'expected uuid for new user'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+
+    # two extra links; login link and group link
+    verify_num_links @all_links_at_start, 2
+  end
+
+  test "setup user with email, first name, repo name and vm uuid" do
+    authorize_with :admin
+
+    post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      repo_name: 'test_repo',
+      vm_uuid: @vm_uuid,
+      user: {
+        first_name: 'test_first_name',
+        email: 'foo@example.com'
+      }
+    }
+
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+    response_object = find_obj_in_resp response_items, 'User', nil
+    assert_not_nil response_object['uuid'], 'expected uuid for new user'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+    assert_equal 'test_first_name', response_object['first_name'], 
+        'expecting first name'
+
+    # four extra links; login link, group link, repo link and vm link
+    verify_num_links @all_links_at_start, 4
+  end
+
+  test "setup user twice with email and check two different objects created" do
+    authorize_with :admin
+
+    post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      repo_name: 'test_repo',
+      user: {
+        email: 'foo@example.com'
+      }
+    }
+
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+    response_object = find_obj_in_resp response_items, 'User', nil
+    assert_not_nil response_object['uuid'], 'expected uuid for new user'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+    verify_num_links @all_links_at_start, 3   # openid, group, and repo. no vm
+
+    # create again
+    post :setup, {
+      user: {email: 'foo@example.com'},
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    assert_response :success
+    response_items = JSON.parse(@response.body)['items']
+    response_object2 = find_obj_in_resp response_items, 'User', nil
+    assert_not_equal response_object['uuid'], response_object2['uuid'], 
+        'expected same uuid as first create operation'
+    assert_equal response_object['email'], 'foo@example.com', 'expected given email'
+
+    # extra login link only
+    verify_num_links @all_links_at_start, 4
+  end
+
+  test "setup user with openid prefix" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      openid_prefix: 'http://www.example.com/account',
+      user: {
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      }
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = find_obj_in_resp response_items, 'User', nil
+
+    assert_equal 'in_create_test_first_name', created['first_name']
+    assert_not_nil created['uuid'], 'expected uuid for new user'
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_nil created['identity_url'], 'expected no identity_url' 
+
+    # verify links
+    # 3 new links: arvados#user, repo, and 'All users' group.
+    verify_num_links @all_links_at_start, 3
+
+    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
+  test "invoke setup with no openid prefix, expect error" do
+    authorize_with :admin
+
+    post :setup, {
+      repo_name: 'test_repo',
+      user: {
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      }
+    }
+
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'openid_prefix parameter is missing'),
+        'Expected ArgumentError'
+  end
+
+  test "setup user with user, vm and repo and verify links" do
+    authorize_with :admin
+
+    post :setup, {
+      user: {
+        first_name: "in_create_test_first_name",
+        last_name: "test_last_name",
+        email: "foo@example.com"
+      },
+      vm_uuid: @vm_uuid,
+      repo_name: 'test_repo',
+      openid_prefix: 'https://www.google.com/accounts/o8/id'
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = find_obj_in_resp response_items, 'User', nil
+
+    assert_equal 'in_create_test_first_name', created['first_name']
+    assert_not_nil created['uuid'], 'expected uuid for new user'
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_nil created['identity_url'], 'expected no identity_url' 
+
+    # expect 4 new links: arvados#user, repo, vm and 'All users' group link
+    verify_num_links @all_links_at_start, 4
+
+    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login', 
+        @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
+  test "create user as non admin user and expect error" do
+    authorize_with :active
+
+    post :create, {
+      user: {email: 'foo@example.com'}
+    }
+
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'PermissionDenied'), 
+          'Expected PermissionDeniedError'
+  end
+
+  test "setup user as non admin user and expect error" do
+    authorize_with :active
+
+    post :setup, {
+      openid_prefix: 'https://www.google.com/accounts/o8/id',
+      user: {email: 'foo@example.com'}
+    }
+
+    response_body = JSON.parse(@response.body)
+    response_errors = response_body['errors']
+    assert_not_nil response_errors, 'Expected error in response'
+    assert (response_errors.first.include? 'PermissionDenied'), 
+          'Expected PermissionDeniedError'
+  end
+
+  test "setup user in multiple steps and verify response" do
+    authorize_with :admin
+
+    post :setup, {
+      openid_prefix: 'http://www.example.com/account',
+      user: {
+        email: "foo@example.com"
+      }
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = find_obj_in_resp response_items, 'User', nil
+
+    assert_not_nil created['uuid'], 'expected uuid for new user'
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_equal created['email'], 'foo@example.com', 'expected input email'
+
+    # verify links; 2 new links: arvados#user, and 'All users' group.
+    verify_num_links @all_links_at_start, 2
+
+    verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#repository', false, 'permission', 'can_write',
+        'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+
+   # invoke setup with a repository
+    post :setup, {
+      openid_prefix: 'http://www.example.com/account',
+      repo_name: 'new_repo',
+      uuid: created['uuid']
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = find_obj_in_resp response_items, 'User', nil
+
+    assert_equal 'foo@example.com', created['email'], 'expected input email'
+
+     # verify links
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
+        'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+
+    # invoke setup with a vm_uuid
+    post :setup, {
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'http://www.example.com/account',
+      user: {
+        email: 'junk_email'
+      },
+      uuid: created['uuid']
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = find_obj_in_resp response_items, 'User', nil
+
+    assert_equal created['email'], 'foo@example.com', 'expected original email'
+
+    # verify links
+    verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    # since no repo name in input, we won't get any; even though user has one
+    verify_link response_items, 'arvados#repository', false, 'permission', 'can_write',
+        'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
+        @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
+  def verify_num_links (original_links, expected_additional_links)
+    links_now = Link.all
+    assert_equal original_links.size+expected_additional_links, Link.all.size,
+        "Expected #{expected_additional_links.inspect} more links"
+  end
+
+  def find_obj_in_resp (response_items, object_type, head_kind=nil)
+    return_obj = nil
+    response_items.each { |x|
+      if !x
+        next
+      end
+
+      if object_type == 'User'
+        if !x['head_kind']
+          return_obj = x
+          break
+        end
+      else  # looking for a link
+        if x['head_kind'] == head_kind
+          return_obj = x
+          break
+        end
+      end
+    }
+    return return_obj
+  end
+
+  def verify_link(response_items, link_object_name, expect_link, link_class,
+        link_name, head_uuid, tail_uuid, head_kind, fetch_object, class_name)
+
+    link = find_obj_in_resp response_items, 'Link', link_object_name
+
+    if !expect_link 
+      assert_nil link, "Expected no link for #{link_object_name}"
+      return
+    end
+
+    assert_not_nil link, "Expected link for #{link_object_name}"
+
+    if fetch_object
+      object = Object.const_get(class_name).where(name: head_uuid)
+      assert [] != object, "expected #{class_name} with name #{head_uuid}"
+      head_uuid = object.first[:uuid]
+    end
+    assert_equal link['link_class'], link_class,
+        "did not find expected link_class for #{link_object_name}"
+    assert_equal link['name'], link_name,
+        "did not find expected link_name for #{link_object_name}"
+    assert_equal link['tail_uuid'], tail_uuid,
+        "did not find expected tail_uuid for #{link_object_name}"
+    assert_equal link['head_kind'], head_kind,
+        "did not find expected head_kind for #{link_object_name}"
+    assert_equal link['head_uuid'], head_uuid,
+        "did not find expected head_uuid for #{link_object_name}"
+  end
+
 end
index 1ceedd7dd20face2204a1dd51b9bff75f23d9a38..5a3250ea0d2dfc51af4d5e4ee4949057448f8d43 100644 (file)
@@ -9,6 +9,18 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
     assert_equal "arvados#collectionList", jresponse['kind']
   end
 
+  test "get index with filters= (empty string)" do
+    get "/arvados/v1/collections", {:format => :json, :filters => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
+    assert_response :success
+    assert_equal "arvados#collectionList", jresponse['kind']
+  end
+
+  test "get index with where= (empty string)" do
+    get "/arvados/v1/collections", {:format => :json, :where => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
+    assert_response :success
+    assert_equal "arvados#collectionList", jresponse['kind']
+  end
+
   test "controller 404 response is json" do
     get "/arvados/v1/thingsthatdonotexist", {:format => :xml}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
     assert_response 404
diff --git a/services/api/test/integration/permissions_test.rb b/services/api/test/integration/permissions_test.rb
new file mode 100644 (file)
index 0000000..c6597d5
--- /dev/null
@@ -0,0 +1,244 @@
+require 'test_helper'
+
+class PermissionsTest < ActionDispatch::IntegrationTest
+  fixtures :users, :groups, :api_client_authorizations, :collections
+
+  test "adding and removing direct can_read links" do
+    auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # try to add permission as spectator
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#user',
+        tail_uuid: users(:spectator).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#collection',
+        head_uuid: collections(:foo_file).uuid,
+        properties: {}
+      }
+    }, auth
+    assert_response 422
+
+    # add permission as admin
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#user',
+        tail_uuid: users(:spectator).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#collection',
+        head_uuid: collections(:foo_file).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    u = jresponse['uuid']
+    assert_response :success
+
+    # read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response :success
+
+    # try to delete permission as spectator
+    delete "/arvados/v1/links/#{u}", {:format => :json}, auth
+    assert_response 403
+
+    # delete permission as admin
+    delete "/arvados/v1/links/#{u}", {:format => :json}, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+  end
+
+
+  test "adding can_read links from user to group, group to collection" do
+    auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
+    
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # add permission for spectator to read group
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#user',
+        tail_uuid: users(:spectator).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#group',
+        head_uuid: groups(:private).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # add permission for group to read collection
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#group',
+        tail_uuid: groups(:private).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#collection',
+        head_uuid: collections(:foo_file).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    u = jresponse['uuid']
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response :success
+
+    # delete permission for group to read collection
+    delete "/arvados/v1/links/#{u}", {:format => :json}, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+    
+  end
+
+
+  test "adding can_read links from group to collection, user to group" do
+    auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
+    
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # add permission for group to read collection
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#group',
+        tail_uuid: groups(:private).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#collection',
+        head_uuid: collections(:foo_file).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # add permission for spectator to read group
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#user',
+        tail_uuid: users(:spectator).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#group',
+        head_uuid: groups(:private).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    u = jresponse['uuid']
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response :success
+
+    # delete permission for spectator to read group
+    delete "/arvados/v1/links/#{u}", {:format => :json}, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+    
+  end
+
+  test "adding can_read links from user to group, group to group, group to collection" do
+    auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
+    admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
+    
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+
+    # add permission for user to read group
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#user',
+        tail_uuid: users(:spectator).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#group',
+        head_uuid: groups(:private).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    assert_response :success
+
+    # add permission for group to read group
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#group',
+        tail_uuid: groups(:private).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#group',
+        head_uuid: groups(:empty_lonely_group).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    assert_response :success
+
+    # add permission for group to read collection
+    post "/arvados/v1/links", {
+      :format => :json,
+      :link => {
+        tail_kind: 'arvados#group',
+        tail_uuid: groups(:empty_lonely_group).uuid,
+        link_class: 'permission',
+        name: 'can_read',
+        head_kind: 'arvados#collection',
+        head_uuid: collections(:foo_file).uuid,
+        properties: {}
+      }
+    }, admin_auth
+    u = jresponse['uuid']
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response :success
+
+    # delete permission for group to read collection
+    delete "/arvados/v1/links/#{u}", {:format => :json}, admin_auth
+    assert_response :success
+
+    # try to read collection as spectator
+    get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth
+    assert_response 404
+  end
+end
index 82f61e0109663ddb34c9850653978c5280db0d59..5285dcf9c42131ef9ee14b9c50d181fb43faec46 100644 (file)
@@ -1,7 +1,281 @@
 require 'test_helper'
 
 class UserTest < ActiveSupport::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+
+  # The fixture services/api/test/fixtures/users.yml serves as the input for this test case
+  setup do
+    @all_users = User.find(:all)
+
+    @all_users.each do |user|
+      if user.is_admin && user.is_active 
+        @admin_user = user
+      elsif user.is_active && !user.is_admin
+        @active_user = user
+      elsif !user.is_active && !user.is_invited 
+        @uninvited_user = user
+      end
+    end
+  end
+
+  test "check non-admin active user properties" do
+    assert !@active_user.is_admin, 'is_admin should not be set for a non-admin user'
+    assert @active_user.is_active, 'user should be active'
+    assert @active_user.is_invited, 'is_invited should be set'
+    assert_not_nil @active_user.prefs, "user's preferences should be non-null, but may be size zero"
+    assert (@active_user.can? :read=>"#{@active_user.uuid}"), "user should be able to read own object"
+    assert (@active_user.can? :write=>"#{@active_user.uuid}"), "user should be able to write own object"
+    assert (@active_user.can? :manage=>"#{@active_user.uuid}"), "user should be able to manage own object"
+
+    assert @active_user.groups_i_can(:read).size > 0, "active user should be able read at least one group"
+
+    # non-admin user cannot manage or write other user objects
+    assert !(@active_user.can? :read=>"#{@uninvited_user.uuid}")
+    assert !(@active_user.can? :write=>"#{@uninvited_user.uuid}")
+    assert !(@active_user.can? :manage=>"#{@uninvited_user.uuid}")
+  end
+
+  test "check admin user properties" do
+    assert @admin_user.is_admin, 'is_admin should be set for admin user'
+    assert @admin_user.is_active, 'admin user cannot be inactive'
+    assert @admin_user.is_invited, 'is_invited should be set'
+    assert_not_nil @admin_user.uuid.size, "user's uuid should be non-null"
+    assert_not_nil @admin_user.prefs, "user's preferences should be non-null, but may be size zero"
+    assert @admin_user.identity_url.size > 0, "user's identity url is expected"
+    assert @admin_user.can? :read=>"#{@admin_user.uuid}"
+    assert @admin_user.can? :write=>"#{@admin_user.uuid}"
+    assert @admin_user.can? :manage=>"#{@admin_user.uuid}"
+
+    assert @admin_user.groups_i_can(:read).size > 0, "admin active user should be able read at least one group"
+    assert @admin_user.groups_i_can(:write).size > 0, "admin active user should be able write to at least one group"
+    assert @admin_user.groups_i_can(:manage).size > 0, "admin active user should be able manage at least one group"
+
+    # admin user can also write or manage other users
+    assert @admin_user.can? :read=>"#{@uninvited_user.uuid}"
+    assert @admin_user.can? :write=>"#{@uninvited_user.uuid}"
+    assert @admin_user.can? :manage=>"#{@uninvited_user.uuid}"
+  end
+
+  test "check inactive and uninvited user properties" do
+    assert !@uninvited_user.is_admin, 'is_admin should not be set for a non-admin user'
+    assert !@uninvited_user.is_active, 'user should be inactive'
+    assert !@uninvited_user.is_invited, 'is_invited should not be set'
+    assert @uninvited_user.can? :read=>"#{@uninvited_user.uuid}"
+    assert @uninvited_user.can? :write=>"#{@uninvited_user.uuid}"
+    assert @uninvited_user.can? :manage=>"#{@uninvited_user.uuid}"
+
+    assert @uninvited_user.groups_i_can(:read).size == 0, "inactive and uninvited user should not be able read any groups"
+    assert @uninvited_user.groups_i_can(:write).size == 0, "inactive and uninvited user should not be able write to any groups"
+    assert @uninvited_user.groups_i_can(:manage).size == 0, "inactive and uninvited user should not be able manage any groups"
+  end
+
+  test "find user method checks" do
+    User.find(:all).each do |user|
+      assert_not_nil user.uuid, "non-null uuid expected for " + user.full_name
+    end
+
+    user = users(:active)     # get the active user
+
+    found_user = User.find(user.id)   # find a user by the row id
+
+    assert_equal found_user.full_name, user.first_name + ' ' + user.last_name
+    assert_equal found_user.identity_url, user.identity_url
+  end
+
+  test "create new user" do 
+    Thread.current[:user] = @admin_user   # set admin user as the current user
+
+    user = User.new
+    user.first_name = "first_name_for_newly_created_user"
+    user.save
+
+    # verify there is one extra user in the db now
+    assert (User.find(:all).size == @all_users.size+1)
+
+    user = User.find(user.id)   # get the user back
+    assert_equal(user.first_name, 'first_name_for_newly_created_user')
+    assert_not_nil user.uuid, 'uuid should be set for newly created user'
+    assert_nil user.email, 'email should be null for newly created user, because it was not passed in'
+    assert_nil user.identity_url, 'identity_url should be null for newly created user, because it was not passed in'
+
+    user.first_name = 'first_name_for_newly_created_user_updated'
+    user.save
+    user = User.find(user.id)   # get the user back
+    assert_equal(user.first_name, 'first_name_for_newly_created_user_updated')
+  end
+
+  test "update existing user" do 
+    Thread.current[:user] = @active_user    # set active user as current user
+    @active_user.first_name = "first_name_changed"
+    @active_user.save
+
+    @active_user = User.find(@active_user.id)   # get the user back
+    assert_equal(@active_user.first_name, 'first_name_changed')
+
+    # admin user also should be able to update the "active" user info
+    Thread.current[:user] = @admin_user # set admin user as current user
+    @active_user.first_name = "first_name_changed_by_admin_for_active_user"
+    @active_user.save
+
+    @active_user = User.find(@active_user.id)   # get the user back
+    assert_equal(@active_user.first_name, 'first_name_changed_by_admin_for_active_user')
+  end
+  
+  test "delete a user and verify" do 
+    active_user_uuid = @active_user.uuid
+
+    Thread.current[:user] = @admin_user     
+    @active_user.delete
+
+    found_deleted_user = false
+    User.find(:all).each do |user| 
+      if user.uuid == active_user_uuid 
+        found_deleted_user = true
+        break
+      end     
+    end
+    assert !found_deleted_user, "found deleted user: "+active_user_uuid
+  
+  end
+
+  test "create new user as non-admin user" do
+    Thread.current[:user] = @active_user
+
+    begin
+      user = User.new
+      user.save
+    rescue ArvadosModel::PermissionDeniedError => e
+    end
+    assert (e.message.include? 'PermissionDeniedError'),
+        'Expected PermissionDeniedError'
+  end
+
+  test "setup new user" do
+    Thread.current[:user] = @admin_user
+
+    email = 'foo@example.com'
+    openid_prefix = 'http://openid/prefix'
+
+    user = User.new
+    user.email = email
+    user.uuid = 'abcdefghijklmnop'
+
+    vm = VirtualMachine.create
+
+    response = User.setup user, openid_prefix, 'test_repo', vm.uuid
+
+    resp_user = find_obj_in_resp response, 'User'
+    verify_user resp_user, email
+
+    oid_login_perm = find_obj_in_resp response, 'Link', 'arvados#user'
+    verify_link oid_login_perm, 'permission', 'can_login', resp_user[:email],
+        resp_user[:uuid]
+    assert_equal openid_prefix, oid_login_perm[:properties][:identity_url_prefix],
+        'expected identity_url_prefix not found for oid_login_perm'
+
+    group_perm = find_obj_in_resp response, 'Link', 'arvados#group'
+    verify_link group_perm, 'permission', 'can_read', resp_user[:uuid], nil
+
+    repo_perm = find_obj_in_resp response, 'Link', 'arvados#repository'
+    verify_link repo_perm, 'permission', 'can_write', resp_user[:uuid], nil
+
+    vm_perm = find_obj_in_resp response, 'Link', 'arvados#virtualMachine'
+    verify_link vm_perm, 'permission', 'can_login', resp_user[:uuid], vm.uuid
+  end
+
+  test "setup new user in multiple steps" do
+    Thread.current[:user] = @admin_user
+
+    email = 'foo@example.com'
+    openid_prefix = 'http://openid/prefix'
+
+    user = User.new
+    user.email = email
+    user.uuid = 'abcdefghijklmnop'
+
+    response = User.setup user, openid_prefix
+
+    resp_user = find_obj_in_resp response, 'User'
+    verify_user resp_user, email
+
+    oid_login_perm = find_obj_in_resp response, 'Link', 'arvados#user'
+    verify_link oid_login_perm, 'permission', 'can_login', resp_user[:email],
+        resp_user[:uuid]
+    assert_equal openid_prefix, oid_login_perm[:properties][:identity_url_prefix],
+        'expected identity_url_prefix not found for oid_login_perm'
+
+    group_perm = find_obj_in_resp response, 'Link', 'arvados#group'
+    verify_link group_perm, 'permission', 'can_read', resp_user[:uuid], nil
+
+    # invoke setup again with repo_name
+    response = User.setup user, openid_prefix, 'test_repo'
+    resp_user = find_obj_in_resp response, 'User', nil
+    verify_user resp_user, email
+    assert_equal user.uuid, resp_user[:uuid], 'expected uuid not found'
+
+    group_perm = find_obj_in_resp response, 'Link', 'arvados#group'
+    verify_link group_perm, 'permission', 'can_read', resp_user[:uuid], nil
+
+    repo_perm = find_obj_in_resp response, 'Link', 'arvados#repository'
+    verify_link repo_perm, 'permission', 'can_write', resp_user[:uuid], nil
+
+    # invoke setup again with a vm_uuid
+    vm = VirtualMachine.create
+
+    response = User.setup user, openid_prefix, 'test_repo', vm.uuid
+
+    resp_user = find_obj_in_resp response, 'User', nil
+    verify_user resp_user, email
+    assert_equal user.uuid, resp_user[:uuid], 'expected uuid not found'
+
+    group_perm = find_obj_in_resp response, 'Link', 'arvados#group'
+    verify_link group_perm, 'permission', 'can_read', resp_user[:uuid], nil
+
+    repo_perm = find_obj_in_resp response, 'Link', 'arvados#repository'
+    verify_link repo_perm, 'permission', 'can_write', resp_user[:uuid], nil
+
+    vm_perm = find_obj_in_resp response, 'Link', 'arvados#virtualMachine'
+    verify_link vm_perm, 'permission', 'can_login', resp_user[:uuid], vm.uuid
+  end
+
+  def find_obj_in_resp (response, object_type, head_kind=nil)
+    return_obj = nil
+    response.each { |x|
+      if x.class.name == object_type
+        if head_kind
+          if x.head_kind == head_kind
+            return_obj = x
+            break
+          end
+        else
+          return_obj = x
+          break
+        end
+      end
+    }
+    return return_obj
+  end
+
+  def verify_user (resp_user, email)
+    assert_not_nil resp_user, 'expected user object'
+    assert_not_nil resp_user['uuid'], 'expected user object'
+    assert_equal email, resp_user['email'], 'expected email not found'
+
+  end
+
+  def verify_link (link_object, link_class, link_name, tail_uuid, head_uuid)
+    assert_not_nil link_object, 'expected link for #{link_class} #{link_name}'
+    assert_not_nil link_object[:uuid],
+        'expected non-nil uuid for link for #{link_class} #{link_name}'
+    assert_equal link_class, link_object[:link_class], 
+        'expected link_class not found for #{link_class} #{link_name}'
+    assert_equal link_name, link_object[:name], 
+        'expected link_name not found for #{link_class} #{link_name}'
+    assert_equal tail_uuid, link_object[:tail_uuid], 
+        'expected tail_uuid not found for #{link_class} #{link_name}'
+    if head_uuid
+      assert_equal head_uuid, link_object[:head_uuid], 
+          'expected head_uuid not found for #{link_class} #{link_name}'
+    end
+  end
+
 end