Merge branch 'master' into 14716-webdav-cluster-config
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 12 Aug 2019 20:47:26 +0000 (17:47 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 12 Aug 2019 20:47:26 +0000 (17:47 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

1  2 
apps/workbench/test/integration/jobs_test.rb
doc/admin/upgrading.html.textile.liquid
lib/config/config.default.yml
lib/config/export.go
lib/config/generated_config.go
sdk/go/arvados/config.go

index a88750c7260ab2af1d06e0130f9a2ab796b71c00,3a1d75928b5f8639be6bf0ecd27fa3fc09f77cd6..7b510f2be9347b0a5f5b121b8d984f8ccf41983b
@@@ -20,106 -20,11 +20,12 @@@ class JobsTest < ActionDispatch::Integr
      StringIO.new content, 'r'
    end
  
-   test "add job description" do
-     job = api_fixture('jobs')['nearly_finished_job']
-     visit page_with_token("active", "/jobs/#{job['uuid']}")
-     # edit job description
-     within('.arv-description-as-subtitle') do
-       find('.fa-pencil').click
-       find('.editable-input textarea').set('*Textile description for job* - "Go to dashboard":/')
-       find('.editable-submit').click
-     end
-     # Verify edited description
-     assert_no_text '*Textile description for job*'
-     assert_text 'Textile description for job'
-     assert_selector 'a[href="/"]', text: 'Go to dashboard'
-   end
-   test 'view partial job log' do
-     need_selenium 'to be able to see the CORS response headers (PhantomJS 1.9.8 does not)'
-     # This config will be restored during teardown by ../test_helper.rb:
-     Rails.configuration.Workbench.LogViewerMaxBytes = 100
-     logdata = fakepipe_with_log_data.read
-     job_uuid = api_fixture('jobs')['running']['uuid']
-     logcollection = upload_data_and_get_collection(logdata, 'active', "#{job_uuid}.log.txt")
-     job = nil
-     use_token 'active' do
-       job = Job.find job_uuid
-       job.update_attributes log: logcollection.portable_data_hash
-     end
-     visit page_with_token 'active', '/jobs/'+job.uuid
-     find('a[href="#Log"]').click
-     wait_for_ajax
-     assert_text 'Showing only 100 bytes of this log'
-   end
-   test 'view log via keep-web redirect' do
-     token = api_token('active')
-     logdata = fakepipe_with_log_data.read
-     logblock = `echo -n #{logdata.shellescape} | ARVADOS_API_TOKEN=#{token.shellescape} arv-put --no-progress --raw -`.strip
-     assert $?.success?, $?
-     job = nil
-     use_token 'active' do
-       job = Job.find api_fixture('jobs')['running']['uuid']
-       mtxt = ". #{logblock} 0:#{logdata.length}:#{job.uuid}.log.txt\n"
-       logcollection = Collection.create(manifest_text: mtxt)
-       job.update_attributes log: logcollection.portable_data_hash
-     end
-     visit page_with_token 'active', '/jobs/'+job.uuid
-     find('a[href="#Log"]').click
-     assert_text 'log message 1'
-   end
-   [
-     ['foobar', false, false],
-     ['job_with_latest_version', true, false],
-     ['job_with_latest_version', true, true],
-   ].each do |job_name, expect_options, use_latest|
-     test "Rerun #{job_name} job, expect options #{expect_options},
-           and use latest version option #{use_latest}" do
-       job = api_fixture('jobs')[job_name]
-       visit page_with_token 'active', '/jobs/'+job['uuid']
-       if expect_options
-         assert_text 'supplied_script_version: master'
-       else
-         assert_no_text 'supplied_script_version'
-       end
-       assert_triggers_dom_event 'shown.bs.modal' do
-         find('a,button', text: 'Re-run job...').click
-       end
-       within('.modal-dialog') do
-         assert_selector 'a,button', text: 'Cancel'
-         if use_latest
-           page.choose("job_script_version_#{job['supplied_script_version']}")
-         end
-         click_on "Run now"
-       end
-       # Re-running jobs doesn't currently work because the test API
-       # server has no git repository to check against.  For now, check
-       # that the error message says something appropriate for that
-       # situation.
-       if expect_options && use_latest
-         assert_text "077ba2ad3ea24a929091a9e6ce545c93199b8e57"
-       else
-         assert_text "Script version #{job['script_version']} does not resolve to a commit"
-       end
-     end
-   end
    [
      ['active', true],
      ['job_reader2', false],
    ].each do |user, readable|
      test "view job with components as #{user} user" do
 +      Rails.configuration.Users.AnonymousUserToken = ""
        job = api_fixture('jobs')['running_job_with_components']
        component1 = api_fixture('jobs')['completed_job_in_publicly_accessible_project']
        component2 = api_fixture('pipeline_instances')['running_pipeline_with_complete_job']
index de7eeaca048e2b63fe5e282b20d50d5ee48267ed,dad4884a2424e212f34bd8d76266c64e09e11ff0..8c2ca765769eb18c6eb79bbe078c0dcde8ba08bc
@@@ -39,15 -39,17 +39,21 @@@ table(table table-bordered table-conden
  |"v1.1.4":#v1_1_4|"v1.1.3":#v1_1_3|"v1.1.2":#v1_1_2|"v1.1.1":#v1_1_1|"v1.1.0":#v1_1_0|
  |\5. "older":#older|
  
- h3(#master). development master (as of 2019-08-05)
 -h3(#master). development master (as of 2019-08-09)
++h3(#master). development master (as of 2019-08-12)
 +
 +h4. Keep-web dropped support on command line flags configuration
 +
 +As we're migrating to a central cluster configuration file, the already deprecated way of getting configurations via environment variables and command line flags isn't valid anymore. Current keep-web supports both the now legacy @keep-web.yml@ config format (used by Arvados 1.4) and the new cluster config file format. Please check "keep-web's install guide":{{site.baseurl}}/install/install-keep-web.html for more details.
  
+ h4. Jobs API is read-only
+ (task "#15133":https://dev.arvados.org/issues/15133 ) The legacy 'jobs' API is now read-only.  It has long been superceded by containers / container_requests (aka crunch v2).  Arvados installations since the end of 2017 (v1.1.0) have probably only used containers, and are unaffected by this change.
+ So that older Arvados sites don't lose access to legacy records, the API has been converted to read-only.  Creating and updating jobs (and related types job_task, pipeline_template and pipeline_instance) is disabled and much of the business logic related has been removed, along with various other code specific to the jobs API.  Specifically, the following programs associated with the jobs API have been removed: @crunch-dispatch.rb@, @crunch-job@, @crunchrunner@, @arv-run-pipeline-instance@, @arv-run@.
  h4. No longer stripping ':' from strings in serialized database columns
  
 (bug #15311) Strings read from serialized columns in the database with a leading ':' would have the ':' stripped after loading the record.  This behavior existed due to legacy serialization behavior which stored Ruby symbols with a leading ':'.  Unfortunately this corrupted fields where the leading ":" was intentional.  This behavior has been removed.
(bug "#15311":https://dev.arvados.org/issues/15311 ) Strings read from serialized columns in the database with a leading ':' would have the ':' stripped after loading the record.  This behavior existed due to legacy serialization behavior which stored Ruby symbols with a leading ':'.  Unfortunately this corrupted fields where the leading ":" was intentional.  This behavior has been removed.
  
  You can test if any records in your database are affected by going to the API server directory and running @bundle exec rake symbols:check@.  This will report which records contain fields with a leading ':' that would previously have been stripped.  If there are records to be updated, you can update the database using @bundle exec rake symbols:stringify@.
  
index 8fe8762c21af73bf6e731282370fc88fb83a9b24,e35671cd72ed57e6988145accaa027571115071f..2c0b53016aee6e767462b77221967bc0eeb79ae1
@@@ -212,8 -212,8 +212,8 @@@ Clusters
        # to run an open instance where anyone can create an account and use
        # the system without requiring manual approval.
        #
 -      # The params auto_setup_new_users_with_* are meaningful only when auto_setup_new_users is turned on.
 -      # auto_setup_name_blacklist is a list of usernames to be blacklisted for auto setup.
 +      # The params AutoSetupNewUsersWith* are meaningful only when AutoSetupNewUsers is turned on.
 +      # AutoSetupUsernameBlacklist is a list of usernames to be blacklisted for auto setup.
        AutoSetupNewUsers: false
        AutoSetupNewUsersWithVmUUID: ""
        AutoSetupNewUsersWithRepository: false
          syslog: {}
          SAMPLE: {}
  
 -      # When new_users_are_active is set to true, new users will be active
 +      # When NewUsersAreActive is set to true, new users will be active
        # immediately.  This skips the "self-activate" step which enforces
        # user agreements.  Should only be enabled for development.
        NewUsersAreActive: false
        # should be an address associated with a Google account.
        AutoAdminUserWithEmail: ""
  
 -      # If auto_admin_first_user is set to true, the first user to log in when no
 +      # If AutoAdminFirstUser is set to true, the first user to log in when no
        # other admin users exist will automatically become an admin user.
        AutoAdminFirstUser: false
  
        NewUserNotificationRecipients: {}
        NewInactiveUserNotificationRecipients: {}
  
 -      # Set anonymous_user_token to enable anonymous user access. You can get
 +      # Set AnonymousUserToken to enable anonymous user access. You can get
        # the token by running "bundle exec ./script/get_anonymous_user_token.rb"
        # in the directory where your API server is running.
        AnonymousUserToken: ""
  
        # Maximum number of log rows to delete in a single SQL transaction.
        #
 -      # If max_audit_log_delete_batch is 0, log entries will never be
 +      # If MaxDeleteBatch is 0, log entries will never be
        # deleted by Arvados. Cleanup can be done by an external process
        # without affecting any Arvados system processes, as long as very
        # recent (<5 minutes old) logs are not deleted.
        # identical to the permission key given to Keep. IMPORTANT: This is
        # a site secret. It should be at least 50 characters.
        #
 -      # Modifying blob_signing_key will invalidate all existing
 +      # Modifying BlobSigningKey will invalidate all existing
        # signatures, which can cause programs to fail (e.g., arv-put,
        # arv-get, and Crunch jobs).  To avoid errors, rotate keys only when
        # no such processes are running.
        # keepstore servers.  Otherwise, reading data blocks and saving
        # collections will fail with HTTP 403 permission errors.
        #
 -      # Modifying blob_signature_ttl invalidates existing signatures; see
 -      # blob_signing_key note above.
 +      # Modifying BlobSigningTTL invalidates existing signatures; see
 +      # BlobSigningKey note above.
        #
        # The default is 2 weeks.
        BlobSigningTTL: 336h
  
        # Default lifetime for ephemeral collections: 2 weeks. This must not
 -      # be less than blob_signature_ttl.
 +      # be less than BlobSigningTTL.
        DefaultTrashLifetime: 336h
  
        # Interval (seconds) between trash sweeps. During a trash sweep,
  
        # If true, enable collection versioning.
        # When a collection's preserve_version field is true or the current version
 -      # is older than the amount of seconds defined on preserve_version_if_idle,
 +      # is older than the amount of seconds defined on PreserveVersionIfIdle,
        # a snapshot of the collection's previous state is created and linked to
        # the current collection.
        CollectionVersioning: false
        # The default setting (false) is appropriate for a multi-user site.
        TrustAllContent: false
  
 +      # Cache parameters for WebDAV content serving:
 +      # * TTL: Maximum time to cache manifests and permission checks.
 +      # * UUIDTTL: Maximum time to cache collection state.
 +      # * MaxCollectionEntries: Maximum number of collection cache entries.
 +      # * MaxCollectionBytes: Approximate memory limit for collection cache.
 +      # * MaxPermissionEntries: Maximum number of permission cache entries.
 +      # * MaxUUIDEntries: Maximum number of UUID cache entries.
 +      WebDAVCache:
 +        TTL: 300s
 +        UUIDTTL: 5s
 +        MaxCollectionEntries: 1000
 +        MaxCollectionBytes:   100000000
 +        MaxPermissionEntries: 1000
 +        MaxUUIDEntries:       1000
 +
      Login:
        # These settings are provided by your OAuth2 provider (e.g.,
        # sso-provider).
            AssignNodeHostname: "compute%<slot_number>d"
  
        JobsAPI:
-         # Enable the legacy Jobs API.  This value must be a string.
+         # Enable the legacy 'jobs' API (crunch v1).  This value must be a string.
+         #
+         # Note: this only enables read-only access, creating new
+         # legacy jobs and pipelines is not supported.
+         #
          # 'auto' -- (default) enable the Jobs API only if it has been used before
          #         (i.e., there are job records in the database)
          # 'true' -- enable the Jobs API despite lack of existing records.
          # {git_repositories_dir}/arvados/.git
          GitInternalDir: /var/lib/arvados/internal.git
  
-         # Docker image to be used when none found in runtime_constraints of a job
-         DefaultDockerImage: ""
-         # none or slurm_immediate
-         CrunchJobWrapper: none
-         # username, or false = do not set uid when running jobs.
-         CrunchJobUser: crunch
-         # The web service must be able to create/write this file, and
-         # crunch-job must be able to stat() it.
-         CrunchRefreshTrigger: /tmp/crunch_refresh_trigger
-         # Control job reuse behavior when two completed jobs match the
-         # search criteria and have different outputs.
-         #
-         # If true, in case of a conflict, reuse the earliest job (this is
-         # similar to container reuse behavior).
-         #
-         # If false, in case of a conflict, do not reuse any completed job,
-         # but do reuse an already-running job if available (this is the
-         # original job reuse behavior, and is still the default).
-         ReuseJobIfOutputsDiffer: false
        CloudVMs:
          # Enable the cloud scheduler (experimental).
          Enable: false
diff --combined lib/config/export.go
index f6b19db252f8292eb4cace79cdf55f88d56f5701,b6d0236bb0b50beb4a62b1d7df42f6c82673d0a8..a0be827f040e61dd8052def574a589404fab216d
@@@ -89,7 -89,6 +89,7 @@@ var whitelist = map[string]bool
        "Collections.PreserveVersionIfIdle":            true,
        "Collections.TrashSweepInterval":               false,
        "Collections.TrustAllContent":                  false,
 +      "Collections.WebDAVCache":                      false,
        "Containers":                                   true,
        "Containers.CloudVMs":                          false,
        "Containers.CrunchRunCommand":                  false,
        "Containers.DefaultKeepCacheRAM":               true,
        "Containers.DispatchPrivateKey":                false,
        "Containers.JobsAPI":                           true,
-       "Containers.JobsAPI.CrunchJobUser":             false,
-       "Containers.JobsAPI.CrunchJobWrapper":          false,
-       "Containers.JobsAPI.CrunchRefreshTrigger":      false,
-       "Containers.JobsAPI.DefaultDockerImage":        false,
        "Containers.JobsAPI.Enable":                    true,
        "Containers.JobsAPI.GitInternalDir":            false,
-       "Containers.JobsAPI.ReuseJobIfOutputsDiffer":   false,
        "Containers.Logging":                           false,
        "Containers.LogReuseDecisions":                 false,
        "Containers.MaxComputeVMs":                     false,
index 8413017b48018be53d0f457499778ffab0f6a415,971b810f5aab6371a4c6a76ef8bc8e72c009f389..5341a256c14da886b3f0a0293ba6d1f380e0f9fc
@@@ -218,8 -218,8 +218,8 @@@ Clusters
        # to run an open instance where anyone can create an account and use
        # the system without requiring manual approval.
        #
 -      # The params auto_setup_new_users_with_* are meaningful only when auto_setup_new_users is turned on.
 -      # auto_setup_name_blacklist is a list of usernames to be blacklisted for auto setup.
 +      # The params AutoSetupNewUsersWith* are meaningful only when AutoSetupNewUsers is turned on.
 +      # AutoSetupUsernameBlacklist is a list of usernames to be blacklisted for auto setup.
        AutoSetupNewUsers: false
        AutoSetupNewUsersWithVmUUID: ""
        AutoSetupNewUsersWithRepository: false
          syslog: {}
          SAMPLE: {}
  
 -      # When new_users_are_active is set to true, new users will be active
 +      # When NewUsersAreActive is set to true, new users will be active
        # immediately.  This skips the "self-activate" step which enforces
        # user agreements.  Should only be enabled for development.
        NewUsersAreActive: false
        # should be an address associated with a Google account.
        AutoAdminUserWithEmail: ""
  
 -      # If auto_admin_first_user is set to true, the first user to log in when no
 +      # If AutoAdminFirstUser is set to true, the first user to log in when no
        # other admin users exist will automatically become an admin user.
        AutoAdminFirstUser: false
  
        NewUserNotificationRecipients: {}
        NewInactiveUserNotificationRecipients: {}
  
 -      # Set anonymous_user_token to enable anonymous user access. You can get
 +      # Set AnonymousUserToken to enable anonymous user access. You can get
        # the token by running "bundle exec ./script/get_anonymous_user_token.rb"
        # in the directory where your API server is running.
        AnonymousUserToken: ""
  
        # Maximum number of log rows to delete in a single SQL transaction.
        #
 -      # If max_audit_log_delete_batch is 0, log entries will never be
 +      # If MaxDeleteBatch is 0, log entries will never be
        # deleted by Arvados. Cleanup can be done by an external process
        # without affecting any Arvados system processes, as long as very
        # recent (<5 minutes old) logs are not deleted.
        # identical to the permission key given to Keep. IMPORTANT: This is
        # a site secret. It should be at least 50 characters.
        #
 -      # Modifying blob_signing_key will invalidate all existing
 +      # Modifying BlobSigningKey will invalidate all existing
        # signatures, which can cause programs to fail (e.g., arv-put,
        # arv-get, and Crunch jobs).  To avoid errors, rotate keys only when
        # no such processes are running.
        # keepstore servers.  Otherwise, reading data blocks and saving
        # collections will fail with HTTP 403 permission errors.
        #
 -      # Modifying blob_signature_ttl invalidates existing signatures; see
 -      # blob_signing_key note above.
 +      # Modifying BlobSigningTTL invalidates existing signatures; see
 +      # BlobSigningKey note above.
        #
        # The default is 2 weeks.
        BlobSigningTTL: 336h
  
        # Default lifetime for ephemeral collections: 2 weeks. This must not
 -      # be less than blob_signature_ttl.
 +      # be less than BlobSigningTTL.
        DefaultTrashLifetime: 336h
  
        # Interval (seconds) between trash sweeps. During a trash sweep,
  
        # If true, enable collection versioning.
        # When a collection's preserve_version field is true or the current version
 -      # is older than the amount of seconds defined on preserve_version_if_idle,
 +      # is older than the amount of seconds defined on PreserveVersionIfIdle,
        # a snapshot of the collection's previous state is created and linked to
        # the current collection.
        CollectionVersioning: false
        # The default setting (false) is appropriate for a multi-user site.
        TrustAllContent: false
  
 +      # Cache parameters for WebDAV content serving:
 +      # * TTL: Maximum time to cache manifests and permission checks.
 +      # * UUIDTTL: Maximum time to cache collection state.
 +      # * MaxCollectionEntries: Maximum number of collection cache entries.
 +      # * MaxCollectionBytes: Approximate memory limit for collection cache.
 +      # * MaxPermissionEntries: Maximum number of permission cache entries.
 +      # * MaxUUIDEntries: Maximum number of UUID cache entries.
 +      WebDAVCache:
 +        TTL: 300s
 +        UUIDTTL: 5s
 +        MaxCollectionEntries: 1000
 +        MaxCollectionBytes:   100000000
 +        MaxPermissionEntries: 1000
 +        MaxUUIDEntries:       1000
 +
      Login:
        # These settings are provided by your OAuth2 provider (e.g.,
        # sso-provider).
            AssignNodeHostname: "compute%<slot_number>d"
  
        JobsAPI:
-         # Enable the legacy Jobs API.  This value must be a string.
+         # Enable the legacy 'jobs' API (crunch v1).  This value must be a string.
+         #
+         # Note: this only enables read-only access, creating new
+         # legacy jobs and pipelines is not supported.
+         #
          # 'auto' -- (default) enable the Jobs API only if it has been used before
          #         (i.e., there are job records in the database)
          # 'true' -- enable the Jobs API despite lack of existing records.
          # {git_repositories_dir}/arvados/.git
          GitInternalDir: /var/lib/arvados/internal.git
  
-         # Docker image to be used when none found in runtime_constraints of a job
-         DefaultDockerImage: ""
-         # none or slurm_immediate
-         CrunchJobWrapper: none
-         # username, or false = do not set uid when running jobs.
-         CrunchJobUser: crunch
-         # The web service must be able to create/write this file, and
-         # crunch-job must be able to stat() it.
-         CrunchRefreshTrigger: /tmp/crunch_refresh_trigger
-         # Control job reuse behavior when two completed jobs match the
-         # search criteria and have different outputs.
-         #
-         # If true, in case of a conflict, reuse the earliest job (this is
-         # similar to container reuse behavior).
-         #
-         # If false, in case of a conflict, do not reuse any completed job,
-         # but do reuse an already-running job if available (this is the
-         # original job reuse behavior, and is still the default).
-         ReuseJobIfOutputsDiffer: false
        CloudVMs:
          # Enable the cloud scheduler (experimental).
          Enable: false
diff --combined sdk/go/arvados/config.go
index a5cf25b8c9217689b6e4ebfe7926c043a0213612,80381aced5c9b485ddc91d3349c08b1a3667f1ca..db4e6dcd89a3e858f67eb7e4ded3531a19f2d3b4
@@@ -57,14 -57,6 +57,14 @@@ func (sc *Config) GetCluster(clusterID 
        }
  }
  
 +type WebDAVCacheConfig struct {
 +      TTL                  Duration
 +      UUIDTTL              Duration
 +      MaxCollectionEntries int
 +      MaxCollectionBytes   int64
 +      MaxPermissionEntries int
 +      MaxUUIDEntries       int
 +}
  type Cluster struct {
        ClusterID       string `json:"-"`
        ManagementToken string
                PreserveVersionIfIdle Duration
                TrashSweepInterval    Duration
                TrustAllContent       bool
 +
 +              WebDAVCache WebDAVCacheConfig
        }
        Git struct {
                Repositories string
@@@ -281,13 -271,8 +281,8 @@@ type ContainersConfig struct 
        UsePreemptibleInstances     bool
  
        JobsAPI struct {
-               Enable                  string
-               GitInternalDir          string
-               DefaultDockerImage      string
-               CrunchJobWrapper        string
-               CrunchJobUser           string
-               CrunchRefreshTrigger    string
-               ReuseJobIfOutputsDiffer bool
+               Enable         string
+               GitInternalDir string
        }
        Logging struct {
                MaxAge                       Duration