| 32 | For help on all actions regarding !LabWiki, please refer to the [wiki:GEC18Agenda/LabWikiAndOEDL/Introduction previous page] |
| 33 | |
| 34 | 1. First, if you have not done it yet, login into !LabWiki |
| 35 | |
| 36 | 2. Create a new experiment file with the name of your choice |
| 37 | |
| 38 | 3. Cut-and-paste the following OEDL experiment description into that file, then save it |
| 39 | {{{ |
| 40 | defProperty('slice', 'cdw', "slice name") |
| 41 | defProperty('tracker', "1", "ID of tracker node") |
| 42 | defProperty('leecher_player', "2,3", "List of leecher/player nodes") |
| 43 | defProperty('seeder', "4", "List of seeder nodes") |
| 44 | defProperty('upload', 2500, 'Maximum torrent upload speed in kb/s') |
| 45 | |
| 46 | tracker = property.tracker.to_s.split(',').map { |x| "#{x}-#{property.slice}" } |
| 47 | leecher_player = property.leecher_player.to_s.split(',').map { |x| "#{x}-#{property.slice}" } |
| 48 | seeder = property.seeder.value.to_s.split(',').map { |x| "#{x}-#{property.slice}" } |
| 49 | allresources = tracker + leecher_player + seeder |
| 50 | |
| 51 | defApplication('clean_all') do |app| |
| 52 | app.description = 'Some commands to ensure that we start with a clean slate' |
| 53 | app.binary_path = 'killall -s9 bttrack transmission-daemon vlc; rm -f /root/.config/transmission-daemon/settings.json; ' |
| 54 | app.quiet = true |
| 55 | end |
| 56 | |
| 57 | defApplication('clean_leechers') do |app| |
| 58 | app.description = 'Ensure that leechers do not have the video from a previous experiment run' |
| 59 | app.binary_path = 'rm -f /root/Downloads/* /root/.config/transmission-daemon/resume/* /root/.config/transmission-daemon/torrents/*' |
| 60 | app.quiet = true |
| 61 | end |
| 62 | |
| 63 | defApplication('bttrack') do |app| |
| 64 | app.description = 'Bittornado BT tracker' |
| 65 | app.binary_path = '/usr/bin/bttrack' |
| 66 | app.defProperty('dfile', 'Database file', '--dfile', {:type => :string}) |
| 67 | app.defProperty('port', 'Port number', '--port', {:type => :integer}) |
| 68 | app.quiet = true |
| 69 | end |
| 70 | |
| 71 | defApplication('transmission_daemon') do |app| |
| 72 | app.description = 'bittorrent client with video streaming support' |
| 73 | app.binary_path = '/usr/local/bin/transmission-daemon' |
| 74 | app.defProperty('foreground', 'Run in foreground', '-f', {:type => :boolean}) |
| 75 | app.quiet = true |
| 76 | app.defMeasurement("stats") do |mp| |
| 77 | mp.defMetric('tor_id', :int32) |
| 78 | mp.defMetric('tor_name', :string) |
| 79 | mp.defMetric('dl_rate', :double) |
| 80 | mp.defMetric('ul_rate', :double) |
| 81 | mp.defMetric('percent_done', :double) |
| 82 | end |
| 83 | end |
| 84 | |
| 85 | defApplication('vlc') do |app| |
| 86 | app.description = 'VideoLAN client media player' |
| 87 | app.binary_path = 'usr/local/bin/vlc.sh' |
| 88 | app.defProperty('vstream', 'URL to play stream from', nil, {:type => :string}) |
| 89 | app.quiet = true |
| 90 | app.defMeasurement("video") do |mp| |
| 91 | mp.defMetric('i_decoded_video_blocks', :int32) |
| 92 | mp.defMetric('i_played_video_frames', :int32) |
| 93 | mp.defMetric('i_lost_video_frames', :int32) |
| 94 | end |
| 95 | end |
| 96 | |
| 97 | defGroup('tracker', *tracker) do |g| |
| 98 | g.addApplication("bttrack") do |app| |
| 99 | app.setProperty('dfile', "/tmp/dfile_#{Time.now.to_i}") |
| 100 | app.setProperty('port', 6969) |
| 101 | end |
| 102 | end |
| 103 | |
| 104 | defGroup('seeder', *seeder) do |g| |
| 105 | g.addApplication("transmission_daemon") do |app| |
| 106 | app.setProperty('foreground', true) |
| 107 | app.measure('stats', :samples => 1) |
| 108 | end |
| 109 | end |
| 110 | |
| 111 | defGroup('leecher', *leecher_player) do |g| |
| 112 | g.addApplication("transmission_daemon") do |app| |
| 113 | app.setProperty('foreground', true) |
| 114 | app.measure('stats', :samples => 1) |
| 115 | end |
| 116 | end |
| 117 | |
| 118 | defGroup('player', *leecher_player) do |g| |
| 119 | g.addApplication("vlc") do |app| |
| 120 | app.setProperty('vstream', "http://localhost:8080/big_buck_bunny_480p_stereo.avi?tor_url=http://192.168.1.1/big_buck_bunny_480p_stereo.avi.torrent") |
| 121 | app.measure('video', :samples => 1) |
| 122 | end |
| 123 | end |
| 124 | |
| 125 | defGroup('all_resources', *allresources) do |g| |
| 126 | g.addApplication("clean_all") |
| 127 | end |
| 128 | |
| 129 | defGroup('all_leechers', *leecher_player) do |g| |
| 130 | g.addApplication("clean_leechers") |
| 131 | end |
| 132 | |
| 133 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 134 | group("all_leechers").startApplications |
| 135 | group("all_resources").startApplications |
| 136 | after 10 do |
| 137 | info "Starting tracker" |
| 138 | group("tracker").startApplications |
| 139 | end |
| 140 | after 15 do |
| 141 | info "Starting seeders" |
| 142 | group("seeder").startApplications |
| 143 | info "Starting leechers" |
| 144 | group("leecher").startApplications |
| 145 | end |
| 146 | after 20 do |
| 147 | # set the upload speed limit |
| 148 | allGroups.exec("/usr/local/bin/transmission-remote -u #{property.upload.value}") |
| 149 | end |
| 150 | after 25 do |
| 151 | info "Starting players" |
| 152 | group("player").startApplications |
| 153 | end |
| 154 | after 220 do |
| 155 | group("all_resources").startApplications |
| 156 | Experiment.done |
| 157 | end |
| 158 | end |
| 159 | |
| 160 | defGraph 'Bittorrent' do |g| |
| 161 | g.ms('stats').select {[ :oml_sender_id, :oml_seq, :oml_ts_server, :percent_done ]} |
| 162 | g.caption "Bittorrent (torrent completion)" |
| 163 | g.type 'line_chart3' |
| 164 | g.mapping :x_axis => :oml_ts_server, :y_axis => :percent_done, :group_by => :oml_sender_id |
| 165 | g.xaxis :legend => 'time [s]' |
| 166 | g.yaxis :legend => 'Completion', :ticks => {:format => 's'} |
| 167 | end |
| 168 | |
| 169 | defGraph 'VLC Player' do |h| |
| 170 | h.ms('video').select {[ :oml_sender_id, :oml_seq, :oml_ts_server, :i_played_video_frames ]} |
| 171 | h.caption "VLC Player (frames played)" |
| 172 | h.type 'line_chart3' |
| 173 | h.mapping :x_axis => :oml_ts_server, :y_axis => :i_played_video_frames, :group_by => :oml_sender_id |
| 174 | h.xaxis :legend => 'time [s]' |
| 175 | h.yaxis :legend => 'Frames played', :ticks => {:format => 's'} |
| 176 | end |
| 177 | }}} |