cnvrg 2.0.11 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +19 -1
- data/lib/cnvrg/api.rb +2 -0
- data/lib/cnvrg/api_v2.rb +1 -0
- data/lib/cnvrg/auth.rb +4 -1
- data/lib/cnvrg/cli.rb +22 -8
- data/lib/cnvrg/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8498090d7edb55682fcc70778016643eba8e37e8a4b588e149ee318b1beecfd8
|
4
|
+
data.tar.gz: 3413d316dbf02cd6e4e8b3adc8f3d3760da0e1e7b39c60c322a8293b63ebb921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db819d57216a924cdbe8eacff8b1c5fdf6d95c082da67b7b54d21e5958ab7ca1fd3c9c636c461b86d5f04bb3c31c85b3ab2ed92679267d98c9d0b913df986c54
|
7
|
+
data.tar.gz: 14575293bf59438342f840ab230327be08b088ced95aafd51429dd046370b27337f99b520ff4c224355bf8477e7d0d5490a87476937c68cb2b42a8d88b1d983b
|
data/Readme.md
CHANGED
@@ -53,4 +53,22 @@
|
|
53
53
|
2021-09-12
|
54
54
|
* DEV-10502 - Bug: Periodic sync stuck
|
55
55
|
## Version v2.0.11
|
56
|
-
2021-10-21
|
56
|
+
2021-10-21
|
57
|
+
## Version v2.0.12
|
58
|
+
2021-10-25
|
59
|
+
* DEV-11544 - Sub-bug: local experiment is failing to run
|
60
|
+
## Version v2.0.13
|
61
|
+
2021-10-27
|
62
|
+
* DEV-11054 - Task: Create organization and user by default
|
63
|
+
## Version v2.0.14
|
64
|
+
2021-11-11
|
65
|
+
* DEV-11834 - Sub-task: add device name to hpu metrics
|
66
|
+
## Version v2.0.15
|
67
|
+
2021-12-12
|
68
|
+
* DEV-12316 - Improvement: cli login should identify saas users automatically
|
69
|
+
## Version v2.0.16
|
70
|
+
2021-12-16
|
71
|
+
* DEV-12316 - Improvement: cli login should identify saas users automatically
|
72
|
+
## Version v2.0.17
|
73
|
+
2021-12-19
|
74
|
+
* DEV-10581 - Bug: CLI - getting 404 response in "cnvrg set_default_owner"
|
data/lib/cnvrg/api.rb
CHANGED
@@ -57,6 +57,7 @@ module Cnvrg
|
|
57
57
|
conn = Faraday.new "#{endpoint_uri}"
|
58
58
|
end
|
59
59
|
conn.headers['Auth-Token'] = @pass
|
60
|
+
conn.headers['Authorization'] = "CAPI #{@pass}"
|
60
61
|
conn.headers['User-Agent'] = "#{Cnvrg::API::USER_AGENT}"
|
61
62
|
conn.options.timeout = 420
|
62
63
|
conn.options.open_timeout=180
|
@@ -169,6 +170,7 @@ module Cnvrg
|
|
169
170
|
when 'POST_FILE'
|
170
171
|
conn = Faraday.new do |fr|
|
171
172
|
fr.headers['Auth-Token'] = @pass
|
173
|
+
fr.headers['Authorization'] = "CAPI #{@pass}"
|
172
174
|
fr.headers['User-Agent'] = "#{Cnvrg::API::USER_AGENT}"
|
173
175
|
fr.headers["Content-Type"] = "multipart/form-data"
|
174
176
|
if !Helpers.is_verify_ssl
|
data/lib/cnvrg/api_v2.rb
CHANGED
@@ -22,6 +22,7 @@ module Cnvrg
|
|
22
22
|
|
23
23
|
conn = Faraday.new endpoint_uri, :ssl => {:verify => !!Helpers.is_verify_ssl}
|
24
24
|
conn.headers['Auth-Token'] = pass
|
25
|
+
conn.headers['Authorization'] = "CAPI #{pass}"
|
25
26
|
conn.headers['User-Agent'] = Cnvrg::API::USER_AGENT
|
26
27
|
conn.headers['Content-Type'] = "application/json"
|
27
28
|
conn.options.timeout = 420
|
data/lib/cnvrg/auth.rb
CHANGED
@@ -44,7 +44,7 @@ module Cnvrg
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def sign_in(email, password)
|
47
|
+
def sign_in(email, password, token: nil)
|
48
48
|
url = Cnvrg::API.endpoint_uri()
|
49
49
|
url = URI.parse(url+ "/users/sign_in")
|
50
50
|
http = Net::HTTP.new(url.host, url.port)
|
@@ -61,6 +61,9 @@ module Cnvrg
|
|
61
61
|
|
62
62
|
req.add_field("EMAIL", email)
|
63
63
|
req.add_field("PASSWORD", password)
|
64
|
+
if token.present?
|
65
|
+
req.add_field("Authorization", "CAPI #{token}")
|
66
|
+
end
|
64
67
|
|
65
68
|
response = http.request(req)
|
66
69
|
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -363,7 +363,7 @@ module Cnvrg
|
|
363
363
|
config = YAML.load_file(path)
|
364
364
|
|
365
365
|
username = config.to_h[:username]
|
366
|
-
res = Cnvrg::API.request("/users/#{username}/get_possible_owners", 'GET')
|
366
|
+
res = Cnvrg::API.request("/api/v1/users/#{username}/get_possible_owners", 'GET')
|
367
367
|
if Cnvrg::CLI.is_response_success(res)
|
368
368
|
owner = username
|
369
369
|
result = res["result"]
|
@@ -372,7 +372,6 @@ module Cnvrg
|
|
372
372
|
choose_owner = result["username"]
|
373
373
|
if owners.empty?
|
374
374
|
else
|
375
|
-
owners << choose_owner
|
376
375
|
chosen = false
|
377
376
|
while !chosen
|
378
377
|
owners_id = owners.each_with_index.map {|x, i| "#{i + 1}. #{x}"}
|
@@ -496,8 +495,10 @@ module Cnvrg
|
|
496
495
|
|
497
496
|
|
498
497
|
desc 'login', 'Authenticate with cnvrg.io platform'
|
498
|
+
method_option :sso, :type => :boolean, :aliases => ["-s", "--sso"], :default => false
|
499
499
|
|
500
500
|
def login
|
501
|
+
use_token = options["sso"]
|
501
502
|
begin
|
502
503
|
log_handler()
|
503
504
|
log_start(__method__, args, options)
|
@@ -515,12 +516,23 @@ module Cnvrg
|
|
515
516
|
exit(0)
|
516
517
|
end
|
517
518
|
@email = ask("Enter your email:")
|
518
|
-
|
519
|
-
|
519
|
+
url = Cnvrg::API.endpoint_uri()
|
520
|
+
use_token = true if url.include?("cloud.cnvrg.io")
|
521
|
+
if use_token
|
522
|
+
@token = cmd.ask("Enter your token (hidden):") {|q| q.echo = "*"}
|
523
|
+
netrc[Cnvrg::Helpers.netrc_domain] = @email, @token
|
524
|
+
netrc.save
|
525
|
+
password = ""
|
526
|
+
else
|
527
|
+
password = cmd.ask("Enter your password (hidden):") {|q| q.echo = "*"}
|
528
|
+
end
|
529
|
+
result = @auth.sign_in(@email, password, token: @token)
|
520
530
|
|
521
531
|
if !result["token"].nil?
|
522
|
-
|
523
|
-
|
532
|
+
unless use_token
|
533
|
+
netrc[Cnvrg::Helpers.netrc_domain] = @email, result["token"]
|
534
|
+
netrc.save
|
535
|
+
end
|
524
536
|
|
525
537
|
log_message("Authenticated successfully as #{@email}", Thor::Shell::Color::GREEN)
|
526
538
|
|
@@ -3327,7 +3339,7 @@ module Cnvrg
|
|
3327
3339
|
end
|
3328
3340
|
|
3329
3341
|
if local
|
3330
|
-
exec_local(cmd)
|
3342
|
+
exec_local(cmd, print_log, start_commit, real, start_time)
|
3331
3343
|
exit_status = $?.exitstatus
|
3332
3344
|
|
3333
3345
|
else
|
@@ -4700,6 +4712,7 @@ module Cnvrg
|
|
4700
4712
|
data_result.each_with_index do |res, i|
|
4701
4713
|
timestamp, value = res["value"]
|
4702
4714
|
uuid = res["metric"]["UUID"].presence || i
|
4715
|
+
uuid = res["metric"]["device"] if query_name == "gaudi"
|
4703
4716
|
stat_value = value.present? ? ("%.2f" % value) : 0 # converting 34.685929244444445 to 34.69
|
4704
4717
|
stat_value = stat_value.to_i == stat_value.to_f ? stat_value.to_i : stat_value.to_f # converting 34.00 to 34
|
4705
4718
|
if query_name.include? 'block'
|
@@ -5884,7 +5897,8 @@ module Cnvrg
|
|
5884
5897
|
end
|
5885
5898
|
end
|
5886
5899
|
|
5887
|
-
def exec_local(cmd)
|
5900
|
+
def exec_local(cmd , print_log, start_commit, real, start_time)
|
5901
|
+
log = []
|
5888
5902
|
PTY.spawn(@exp.as_env, cmd) do |stdout, stdin, pid, stderr|
|
5889
5903
|
begin
|
5890
5904
|
stdout.each do |line|
|
data/lib/cnvrg/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cnvrg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yochay Ettun
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-01-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -488,7 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
488
488
|
- !ruby/object:Gem::Version
|
489
489
|
version: '0'
|
490
490
|
requirements: []
|
491
|
-
rubygems_version: 3.
|
491
|
+
rubygems_version: 3.0.3
|
492
492
|
signing_key:
|
493
493
|
specification_version: 4
|
494
494
|
summary: A CLI tool for interacting with cnvrg.io.
|