Class: Cnvrg::Data

Inherits:
SubCommandBase show all
Defined in:
lib/cnvrg/data.rb

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner, subcommand_prefix

Instance Method Details

#clone(dataset_url) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/cnvrg/data.rb', line 95

def clone(dataset_url)
  #test
  cli = Cnvrg::CLI.new()
  only_tree =options[:only_tree]
  commit =options[:commit]
  query =options[:query]
  read = options[:read]
  remote = options[:remote]
  cli.clone_data(dataset_url, only_tree=only_tree,commit=commit, query=query, read=read, remote=remote, relative: options[:relative])
end

#clone_query(dataset_url) ⇒ Object



136
137
138
139
140
# File 'lib/cnvrg/data.rb', line 136

def clone_query(dataset_url)
  cli = Cnvrg::CLI.new()
  query =options[:query]
  cli.clone_data_query(dataset_url,query=query)
end

#commitsObject



157
158
159
160
161
# File 'lib/cnvrg/data.rb', line 157

def commits()
  cli = Cnvrg::CLI.new()
  cli.list_dataset_commits()

end

#delete(dataset_slug) ⇒ Object



143
144
145
146
147
# File 'lib/cnvrg/data.rb', line 143

def delete(dataset_slug)
  cli = Cnvrg::CLI.new()
  cli.delete_data(dataset_slug)

end

#downloadObject



78
79
80
81
82
83
84
85
86
# File 'lib/cnvrg/data.rb', line 78

def download()
  cli = Cnvrg::CLI.new()
  verbose = options["verbose"]
  sync = options["sync"]
  new_branch = options["new_branch"]
  commit = options["commit"]
  all_files = options["all_files"]
  cli.download_data_new(verbose,sync,new_branch, commit,all_files)
end

#download_tags_yamlObject



194
195
196
197
# File 'lib/cnvrg/data.rb', line 194

def download_tags_yaml
  cli = Cnvrg::CLI.new()
  cli.download_tags_yaml()
end

#files(dataset_url) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/cnvrg/data.rb', line 168

def files(dataset_url)
  cli = Cnvrg::CLI.new()
  cli.verify_logged_in(false)
  cli.log_start(__method__, args, options)
  @dataset = Dataset.new(dataset_url: dataset_url)
  files = @dataset.list_files(
      commit_sha1: options[:commit_sha1],
      limit: options[:limit],
      expires: options[:expires],
      offset: options[:offset])
  cli.log_message(files)
end

#initObject



19
20
21
22
23
24
# File 'lib/cnvrg/data.rb', line 19

def init
  cli = Cnvrg::CLI.new()
  public = options["public"]
  bucket = options["bucket"]
  cli.init_data(public, bucket: bucket)
end

#listObject



149
150
151
152
153
154
# File 'lib/cnvrg/data.rb', line 149

def list()
  cli = Cnvrg::CLI.new()

  cli.list_dataset()

end

#put(dataset_url, *files) ⇒ Object



128
129
130
131
132
# File 'lib/cnvrg/data.rb', line 128

def put(dataset_url, *files)
  cli = Cnvrg::CLI.new()
  dir = options[:dir]
  cli.data_put(dataset_url, files: files, dir: dir)
end

#queriesObject



182
183
184
185
# File 'lib/cnvrg/data.rb', line 182

def queries()
  cli = Cnvrg::CLI.new()
  cli.queries()
end

#query_files(query) ⇒ Object



188
189
190
191
# File 'lib/cnvrg/data.rb', line 188

def query_files(query)
  cli = Cnvrg::CLI.new()
  cli.query_files(query)
end

#setObject



117
118
119
120
121
122
123
124
# File 'lib/cnvrg/data.rb', line 117

def set
  cli = Cnvrg::CLI.new
  cli.log_start(__method__)
  cli.log_handler
  if options['url'].present?
    cli.set_data_url(options['url'])
  end
end

#sync_data_newObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cnvrg/data.rb', line 57

def sync_data_new()
  cli = Cnvrg::CLI.new()
  force = options["force"]
  new_branch = options["new_branch"]
  verbose = options["verbose"]
  commit = options["commit"]
  all_files = options["all_files"]
  tags = options["tags"]
  parallel=options["parallel"]
  chunk_size = options["chunk_size"]
  init = options["init"]
  message = options["message"]
  cli.sync_data_new(new_branch, force, verbose, commit, all_files, tags, parallel, chunk_size, init, message)
end

#test(data_url) ⇒ Object



201
202
203
204
205
206
207
208
209
210
# File 'lib/cnvrg/data.rb', line 201

def test(data_url)
  cli = Cnvrg::CLI.new
  cli.verify_logged_in(true)
  cli.log_start(__method__, args, options)
  @dataset = Dataset.new(dataset_url: data_url)
  resp = @dataset.get_storage_client
  @dataset.init_home(remote: false)
  @dataset.download_softlink

end

#uploadObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cnvrg/data.rb', line 34

def upload
  cli = Cnvrg::CLI.new()
  verbose = options["verbose"]
  sync = options["sync"]
  force = options["force"]
  new_branch = options["new_branch"]
  chunk_size = options["chunk_size"]
  tags = options["tags"]
  message = options["message"]
  cli.upload_data_new(new_branch, verbose, sync, force, tags, chunk_size, message:message)
end

#verify(*dataset_titles) ⇒ Object



109
110
111
112
113
# File 'lib/cnvrg/data.rb', line 109

def verify(*dataset_titles)
  cli = Cnvrg::CLI.new()
  timeout =options[:timeout]
  cli.verify_datasets(dataset_titles, timeout)
end