Class: GlobusClient::EndpointManager

Inherits:
Object
  • Object
show all
Defined in:
lib/globus_client/endpoint_manager.rb

Overview

The namespace for endpoint management API operations

Constant Summary collapse

IN_PROGRESS_STATUSES =
%w[ACTIVE INACTIVE].freeze

Instance Method Summary collapse

Instance Method Details

#task_list(owner_id: nil, status: [], destination_path: nil) ⇒ Array

List tasks for the configured transfer endpoint docs.globus.org/api/transfer/advanced_collection_management/#get_tasks Note that this method does not support pagination, as there are unlikely to be many tasks. Also note that if destination_path is provided, only transfer tasks will be returned.

Parameters:

  • owner_id (String) (defaults to: nil)

    the Globus user ID (a UUID, not email address)

  • status (Array) (defaults to: [])

    the status of the tasks to filter on. Values are ACTIVE, INACTIVE, SUCCEEDED, or FAILED.

  • destination_path (String) (defaults to: nil)

    the destination path to filter tasks by

Returns:

  • (Array)

    list of task documents



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/globus_client/endpoint_manager.rb', line 16

def task_list(owner_id: nil, status: [], destination_path: nil)
  tasks = GlobusClient.instance.get(
    base_url: GlobusClient.config.transfer_url,
    path: '/v0.10/endpoint_manager/task_list',
    params: task_list_params(owner_id:, status:)
  )['DATA']
  return tasks unless destination_path

  destination_base_path = destination_path.delete_suffix('/') << '/'
  tasks.select { |task| task['destination_base_path']&.start_with?(destination_base_path) }
end

#tasks_in_progress?(owner_id: nil, destination_path: nil) ⇒ boolean

Returns true if there are tasks in progress.

Parameters:

  • owner_id (String) (defaults to: nil)

    the Globus user ID (a UUID, not email address)

  • destination_path (String) (defaults to: nil)

    the destination path to filter tasks by

Returns:

  • (boolean)

    true if there are tasks in progress



31
32
33
# File 'lib/globus_client/endpoint_manager.rb', line 31

def tasks_in_progress?(owner_id: nil, destination_path: nil)
  task_list(owner_id:, destination_path:, status: IN_PROGRESS_STATUSES).present?
end