Module: Cnvrg::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/cnvrg/helpers.rb

Instance Method Summary collapse

Instance Method Details

#checkmarkObject



5
6
7
8
# File 'lib/cnvrg/helpers.rb', line 5

def checkmark
checkmark = "\u2713"
return checkmark.encode('utf-8')
end

#cnvrgignore_contentObject



26
27
28
29
30
31
32
33
# File 'lib/cnvrg/helpers.rb', line 26

def cnvrgignore_content
  %{
           # cnvrg ignore: Ignore the following directories and files
# for example:
# some_dir/
# some_file.txt
        }.strip
end

#cpu_timeObject

cpu



76
77
78
# File 'lib/cnvrg/helpers.rb', line 76

def cpu_time
  Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :microsecond)
end

#get_mem(pid) ⇒ Object

memory



86
87
# File 'lib/cnvrg/helpers.rb', line 86

def get_mem(pid)
end

#linux?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cnvrg/helpers.rb', line 22

def linux?
  not mac? and not windows?
end

#look_for_in_path(path, name) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/cnvrg/helpers.rb', line 64

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

Returns:

  • (Boolean)


18
19
20
# File 'lib/cnvrg/helpers.rb', line 18

def mac?
  !!(RUBY_PLATFORM =~ /-darwin\d/)
end

#netrc_domainObject



60
61
62
# File 'lib/cnvrg/helpers.rb', line 60

def netrc_domain
  "cnvrg.io"
end

#readme_contentObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cnvrg/helpers.rb', line 35

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_urlObject



10
11
12
# File 'lib/cnvrg/helpers.rb', line 10

def remote_url
    "https://cnvrg.io"
end

#wall_timeObject



80
81
82
# File 'lib/cnvrg/helpers.rb', line 80

def wall_time
  Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
end

#windows?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/cnvrg/helpers.rb', line 14

def windows?
  !!(RUBY_PLATFORM =~ /mswin32|mingw32/)
end