Module: Cnvrg::Helpers
Instance Method Summary collapse
- #checkmark ⇒ Object
- #cnvrgignore_content ⇒ Object
-
#cpu_time ⇒ Object
cpu.
-
#get_mem(pid) ⇒ Object
memory.
- #internet_connection? ⇒ Boolean
- #linux? ⇒ Boolean
- #look_for_in_path(path, name) ⇒ Object
- #mac? ⇒ Boolean
- #netrc_domain ⇒ Object
- #readme_content ⇒ Object
- #remote_url ⇒ Object
- #ubuntu? ⇒ Boolean
- #wall_time ⇒ Object
- #windows? ⇒ Boolean
Instance Method Details
#checkmark ⇒ Object
5 6 7 8 |
# File 'lib/cnvrg/helpers.rb', line 5 def checkmark checkmark = "\u2713" return checkmark.encode('utf-8') end |
#cnvrgignore_content ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/cnvrg/helpers.rb', line 36 def cnvrgignore_content %{ # cnvrg ignore: Ignore the following directories and files # for example: # some_dir/ # some_file.txt }.strip end |
#cpu_time ⇒ Object
cpu
86 87 88 |
# File 'lib/cnvrg/helpers.rb', line 86 def cpu_time Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :microsecond) end |
#get_mem(pid) ⇒ Object
memory
96 97 |
# File 'lib/cnvrg/helpers.rb', line 96 def get_mem(pid) end |
#internet_connection? ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/cnvrg/helpers.rb', line 10 def internet_connection? begin true if open("http://www.google.com/") rescue false end end |
#linux? ⇒ Boolean
29 30 31 |
# File 'lib/cnvrg/helpers.rb', line 29 def linux? not mac? and not windows? end |
#look_for_in_path(path, name) ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/cnvrg/helpers.rb', line 74 def look_for_in_path(path, name) url_split = path.split("/") url_split.each_with_index do |u, i| if u == name return i end end return -1 end |
#mac? ⇒ Boolean
25 26 27 |
# File 'lib/cnvrg/helpers.rb', line 25 def mac? !!(RUBY_PLATFORM =~ /-darwin\d/) end |
#netrc_domain ⇒ Object
70 71 72 |
# File 'lib/cnvrg/helpers.rb', line 70 def netrc_domain "cnvrg.io" end |
#readme_content ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cnvrg/helpers.rb', line 45 def readme_content %{ # README This README would normally contain some context and description about the project. Things you may want to cover: * Data description * Benchmark and measurement guidelines * Used algorithms * Scores * Configurations * Requirements * How to run the experiments * ...}.strip end |
#remote_url ⇒ Object
17 18 19 |
# File 'lib/cnvrg/helpers.rb', line 17 def remote_url "https://cnvrg.io" end |
#ubuntu? ⇒ Boolean
32 33 34 35 |
# File 'lib/cnvrg/helpers.rb', line 32 def ubuntu? unix = `cat /etc/lsb-release`.downcase! return unix.include? "ubuntu" end |
#wall_time ⇒ Object
90 91 92 |
# File 'lib/cnvrg/helpers.rb', line 90 def wall_time Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond) end |
#windows? ⇒ Boolean
21 22 23 |
# File 'lib/cnvrg/helpers.rb', line 21 def windows? !!(RUBY_PLATFORM =~ /mswin32|mingw32/) end |