Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8dc14d5

Browse files
committed
Handle a run without an existing scraper
1 parent 0a724e8 commit 8dc14d5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/controllers/api_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def run_remote
3030
response.stream.write({stream: "stdout", text: "You currently can't start a scraper run. See https://morph.io for more details"}.to_json + "\n")
3131
response.stream.close
3232
else
33-
author
3433
run = Run.create(queued_at: Time.now, auto: false, owner_id: user.id)
3534

3635
Archive::Tar::Minitar.unpack(params[:code].tempfile, run.repo_path)

lib/morph/container_compiler.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ def self.compile_and_run_original(run)
99
yield(wrapper)
1010

1111
command = Metric.command(run.language.scraper_command, Run.time_output_filename)
12+
env_variables = run.scraper ? run.scraper.variables.map{|v| [v.name, v.value]} : []
1213
status_code = Morph::DockerRunner.run(
1314
command: command,
1415
user: "scraper",
1516
image_name: run.language.docker_image,
1617
container_name: docker_container_name(run),
1718
repo_path: run.repo_path,
1819
data_path: run.data_path,
19-
env_variables: run.scraper.variables.map{|v| [v.name, v.value]}
20+
env_variables: env_variables
2021
) do |on|
2122
on.log {|s,c| wrapper.call(:log, s, c)}
2223
on.ip_address {|ip| wrapper.call(:ip_address, ip)}

0 commit comments

Comments
 (0)