- def lftp_mirror
- @result_root.delete_prefix!('/srv')
- srv_http_host = job['SRV_HTTP_HOST'] || '124.160.11.58'
- srv_http_port = job['SRV_HTTP_PORT'] || '11300'
- url = "http://#%7Bsrv_http_host%7D:#%7Bsrv_http_port%7D#%7B@result_root%7D"
- system "lftp -c mirror #{url} >/dev/null 2>&1"
- end
- def lftp(data)
- if @result_root
lftp_mirror
Seems it'll repeatedly call lftp on every new message?
When do we start downloading? Ideally do it once after extract stats.
- else
set_result_root(data)
That else seems illogical. Typically we set a var before checking it. Maybe lftp_mirror will be called at the next message, however it's still illogical thing.
Thanks, Fengguang
- end
- end
- def stop(data, web_socket, code = 1000, reason = 'normal') @stop_query.each do |key, value| return false unless data[key] == value
@@ -109,7 +136,7 @@ class Monitor
@query.each do |k, v| @query[k] = JSON.parse(v)
- rescue
- rescue StandardError end query = @query.to_json puts "query=>#{query}"
@@ -136,6 +163,7 @@ class Monitor
output(data) connect(data, ws)
lftp(data) stop(data, ws) if @action['stop'] end
diff --git a/sbin/submit b/sbin/submit index 05b3e86dd..a92556fff 100755 --- a/sbin/submit +++ b/sbin/submit @@ -47,6 +47,10 @@ options = OptionParser.new do |opts| actions << 'connect' end
- opts.on('-l', '--lftp', 'lftp mirror job result') do
- actions << 'lftp_result'
- end
- opts.on('-m', '--monitor', "monitor job status: use -m 'KEY: VALUE' to add rule") do opt_monitor = true filter = YAML.load ARGV[0] if ARGV[0]
-- 2.23.0