Project

General

Profile

Actions

Feature #2176

closed

API server supports atomic find_or_create operation

Added by Tom Clegg about 10 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Story points:
1.0

Description

Generalize the special case in jobs.create.

Add optional find_or_create flag to create method. If set:
  • If filters parameter is provided, look up objects using those filters.
    • If exactly one result is found, return that.
    • If no results are found, create a new object as usual.
    • If >1 results are found, return an error.
  • If filters parameter is not provided, look up objects using the provided resource_attrs as a where parameter, and proceed as above.
Jobs.create should be rearranged to use the generic mechanism.
  • Move no_reuse (and other params that aren't actually resource attributes) out of resource_attrs, e.g., params[:job][:minimum_script_version]=X should move to something like params[:filters]=[['script_version','>=',X]] and JobsController should override apply_where_limit_order_params to use find_commit_range when >= and <= filters are used with the script_version attribute.
  • Implement exclude_script_versions=X as params[:filters]=[['script_version','not in',X]] (adding a "not in" operator should be trivial)
  • Implement the range logic so the client can do commit range lookups itself using list, not just implicitly via create

Subtasks 1 (0 open1 closed)

Task #2637: Add support for filters to generic create APIClosedPeter Amstutz03/07/2017Actions
Actions #1

Updated by Tom Clegg about 10 years ago

  • Release set to 4
Actions #2

Updated by Tom Clegg about 10 years ago

  • Target version set to 2014-05-07 Storing and Organizing Data
Actions #3

Updated by Tom Clegg about 10 years ago

  • Subject changed from API server supports find_or_create operation to API server supports atomic find_or_create operation
  • Description updated (diff)
Actions #4

Updated by Peter Amstutz about 10 years ago

  • Assigned To set to Peter Amstutz
Actions #5

Updated by Tom Clegg about 10 years ago

  • Target version deleted (2014-05-07 Storing and Organizing Data)
  • Release deleted (4)
Actions #6

Updated by Tom Clegg almost 10 years ago

  • Target version set to Arvados Future Sprints
Actions #7

Updated by Peter Amstutz almost 8 years ago

  • Assigned To deleted (Peter Amstutz)
Actions #8

Updated by Peter Amstutz about 7 years ago

  • Status changed from New to Closed

Containers API uses a different approach. Does not have compelling use case in other APIs.

Actions #9

Updated by Tom Clegg about 7 years ago

  • Target version deleted (Arvados Future Sprints)
Actions

Also available in: Atom PDF