Giter Club home page Giter Club logo

Comments (10)

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Hi,

Thank you very much for raising this issue and providing all these details! I'm sorry that it's not working for you. Just to check, I noticed that there was a ? before wdpa_fetch(). Did you encounter the error when running code that did not contain the ??. E.g., something like this:

# load package
library(wdpar)

# make a list of countries
countries <- c("Vietnam","Malaysia","Laos")

# loop over countries to get all shapefile data
dat <- list()
for (i in countries) {
 message("starting ", i)
 dat[[i]] <- wdpa_fetch(i, wait = TRUE, download_dir = getwd())
}

If you encounter the error in the first iteration of the loop, you might need to restart your computer.

Also, here's some additional details in case it helps identify what's going wrong. Normally, wdpa_fetch() will start up a new PhantomJS process, use it to download the data, and then kill it (seperately for each country). The PhantomJS signals port = 4567 is already in use. error indicates that a PhantomJS web driver is already running. So, if you see this on the second iteration then this would suggest that wdpar didn't kill the process correctly after the first iteration.

Also, I wouldn't expect this to make a difference, but could you please try using the latest version of R?

from wdpar.

RussellGrayxd avatar RussellGrayxd commented on May 30, 2024

from wdpar.

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Ah ok - thanks for clarifying that! Ok - I'll create a branch in a moment to implement the random ports idea for testing. Note that this doesn't entirely fix the issue though. Since the error is caused by the R code failing to kill Selenium processes once it's finished with them, this means that running the code in a loop will result in lots of zombie processes and, in turn, mean that they could consume lots of memory. Is that ok? Basically, this means you would probably want to restart your computer after the loop has finished running.

from wdpar.

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Another option could involve manually killing the Selenium processes each step in the loop (based on ropensci/RSelenium#228 (comment)). For example, something like this:

# load package
library(wdpar)

# make a list of countries
countries <- c("Vietnam","Malaysia","Laos")

# loop over countries to get all shapefile data
dat <- list()
for (i in countries) {
  message("starting ", i)
  dat[[i]] <- wdpa_fetch(i, wait = TRUE, download_dir = getwd())
  try(system("taskkill /im java.exe /f", intern = FALSE, ignore.stdout = FALSE))
}



from wdpar.

RussellGrayxd avatar RussellGrayxd commented on May 30, 2024

from wdpar.

RussellGrayxd avatar RussellGrayxd commented on May 30, 2024

from wdpar.

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Ah ok - thanks for trying that.

from wdpar.

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Could you please try running the code using the wd-proc branch? I've randomized the port and tried to make the code more robust for killing the processes. You can install it with:

remotes::install_github("prioritizr/wdpar@wd-proc")

from wdpar.

RussellGrayxd avatar RussellGrayxd commented on May 30, 2024

from wdpar.

jeffreyhanson avatar jeffreyhanson commented on May 30, 2024

Awesome! Thanks for letting me know that fixed it - I'll merge those fixes into the main branch.

from wdpar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.