Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging connection to mapknitter-exporter #7

Closed
jywarren opened this issue Apr 14, 2019 · 22 comments
Closed

Debugging connection to mapknitter-exporter #7

jywarren opened this issue Apr 14, 2019 · 22 comments

Comments

@jywarren
Copy link
Member

Just noting here that i've been making tweaks to main.rb to get this running, and we are almost there! We will also have to refactor the run_export method once we adopt the final export.json format, but are OK for now.

We could do an interim which checks the first image and uses data from there, AND/OR averages scales from all images, as a fallback. The needed fields are:

id, user_id/map_id, scale and optionally google_api_key

I've been publishing new versions in Google Cloud Run once Cloud Build sees new commits on main branch of this repo, and testing.

Also, just noting, i'm going to try to set up a custom domain at export.mapknitter.org!

@jywarren
Copy link
Member Author

cc @icarito 😄

@jywarren
Copy link
Member Author

Wow got failed now - but it ran! https://mapknitter-exporter-d6yfsgjd2q-uc.a.run.app/

@jywarren
Copy link
Member Author

2019-04-14T16:18:35.106698Zrm: cannot remove './public/warps/13015/': No such file or directory

@jywarren
Copy link
Member Author

😄 https://export.mapknitter.org/ works now!

Ok, but it's failing...

@jywarren
Copy link
Member Author

i took out the rescue to see the error fully.

@jywarren
Copy link
Member Author

Hmm, Cloud Build isn't seeing the latest commit...

Using mapknitter-exporter 0.0.1 from https://github.com/publiclab/mapknitter-exporter (at main@39a01e9)

@jywarren
Copy link
Member Author

Hmm. I tried bumping the gemspec version to 0.0.2...

@jywarren
Copy link
Member Author

I tried republishing a 0.0.2 gem...

@jywarren
Copy link
Member Author

Hmm.

Fetching https://github.com/publiclab/mapknitter-exporter
Could not find mapknitter-exporter-0.0.2 in any of the sources
The command '/bin/sh -c bundle install' returned a non-zero code: 7

@jywarren
Copy link
Member Author

Oh, i get it! We have to peg the commit here:

revision: 39a01e941df1ed392209c3d94e67afbd078675df

@jywarren
Copy link
Member Author

Done in 5e21fbb

@jywarren
Copy link
Member Author

That worked! Debugging next step.

@jywarren
Copy link
Member Author

@jywarren
Copy link
Member Author

aha! 2019-04-14T20:17:24.450634ZMemory limit of 256M exceeded with 326M used. Consider increasing the memory limit, see https://cloud.google.com/run/docs/configuring/memory-limits

@jywarren
Copy link
Member Author

jywarren commented Apr 14, 2019

OK, i took this pretty far. I now see this error:

https://export.mapknitter.org/export?url=https://mapknitter.org/maps/ceres--2/warpables.json

FloatDomainError at /export
NaN
file: mapknitterExporter.rb location: to_i line: 131

On this line:

https://github.com/publiclab/mapknitter-exporter/blob/c73a5e9759c88bfdbfb4617dc8c19dd99e040847/lib/mapknitterExporter.rb#L131

require "mapknitterExporter"
require "json"
require "open-uri"

data = JSON.parse(open("https://mapknitter.org/maps/ceres--2/warpables.json").read)
class Export
  attr_accessor :status, :tms, :geotiff, :zip, :jpg, :user_id, :size, :width, :height, :cm_per_pixel
  def save
    true
  end
end
export = Export.new
MapKnitterExporter.run_export(1,1,export,1,'.',data,'')

@jywarren
Copy link
Member Author

I removed the to_i from lines 130 and 131... oddly this error doesn't occur when running this locally as in the test code i pasted above.

But i worry that the to_i giving a NaN (not a number) means that somehow we are doing arithmatic with strings... i just can't see where because it's working locally...

@jywarren
Copy link
Member Author

Aha! NaN involved dividing by zero! I added a check for zero.

@jywarren
Copy link
Member Author

@jywarren
Copy link
Member Author

i also had to increase the memory to 1gb. Depending on how this goes, we may need to increase it more, esp. for large exports.

@jywarren
Copy link
Member Author

Next we'll be able to try (from publiclab/mapknitter#364) this one with a lot of images: https://mapknitter.org/maps/irish-uk-border-mapping/warpables.json

@jywarren
Copy link
Member Author

ok - upstream request timeout - this may relate to the background job issue referenced in #4 --

@jywarren
Copy link
Member Author

Closing this as it seems to be running!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant