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

Error in { : task 14 failed - "unable to start png() device" #434

Closed
gedkitchener-CT opened this issue Jul 21, 2022 · 6 comments
Closed
Assignees

Comments

@gedkitchener-CT
Copy link

Project Robyn

Describe issue

Ran model with 5 trials - fine.

Ran again with 10 trials - I get the following error message:

>>> Exporting all charts into directory: C:/Users/.../2022-07-20 16.06 init...
>>> Plotting summary charts...
No spend-exposure modelling needed. all media variables used for mmm are spend variables 
>>> Plotting 171 Pareto optimum models on 6 cores...
  |                                                                                              |   0%Error in { : task 14 failed - "unable to start png() device"
In addition: Warning messages:
1: package ‘doRNG’ was built under R version 4.1.2 
2: package ‘foreach’ was built under R version 4.1.2 
 Error in { : task 14 failed - "unable to start png() device"

6. stop(simpleError(msg, call = expr)) 
5. e$fun(obj, substitute(ex), parent.frame(), e$data) 
4. structure(list(args = uniqueSol(.doRNG.stream = list(c(10407L, 
-76253865L, -1148296788L, -844762435L, 234093146L, -1972368365L, 
-1737907656L), c(10407L, -1793080333L, -348917575L, 1074043502L, 
494141499L, 1248036383L, 367895649L), c(10407L, -982643044L,  ... 
3. do.call("%dopar%", list(obj, ex), envir = parent.frame()) 
2. foreach(sid = uniqueSol) %dorng% {
    plotMediaShareLoop <- plotMediaShare[solID == sid]
    rsq_train_plot <- plotMediaShareLoop[, round(unique(rsq_train), 
        4)] ... at model.R#501
1. robyn_run(InputCollect = InputCollect, plot_folder = robyn_object, 
    pareto_fronts = 3, plot_pareto = TRUE)

Extremely frustrating as this was training for 5+ hours and seemed to be fine - but as a result of a plotting error, the whole model gets discarded! To use an earlier analogy, this feels like baking a beautiful cake, but because my camera can't fit the whole cake in shot, the cake just vanishes!

What does this error mean? I can't make sense of the output to know what's happening (i.e., what part of the loop in step 2 is causing the error?)

@laresbernardo laresbernardo self-assigned this Jul 21, 2022
@laresbernardo
Copy link
Collaborator

laresbernardo commented Jul 21, 2022

Hi @gedkitchener-CT
I'm really sorry to hear that! We did split robyn_run(..., export = FALSE) and robyn_outputs() to avoid these potential issues, so you train the models and then process/export the results in 2 separate steps.
We've seen this is potentially caused for use cases with a lot of media variables. How many variables are you modeling with?
On the other hand, I think you have an outdated version. Can you please update to the latest (dev) version and retry to see if you still get this error? If not, please share a reproducible example so I can take a further look into this potential bug.

@gedkitchener-CT
Copy link
Author

Thanks for such a speedy response.

I've got about 30 features and 1,000-ish rows (daily) - in your experience, did that amount of features (30+) sometimes cause this issue in the past?

To be honest, I do have an out-dated version - I'll try switching to the latest (dev) version and run again.

Thanks again for the advice.

@laresbernardo
Copy link
Collaborator

We encourage a ~1:10 relation between columns and rows minimum as a rule of thumb. Let me know how it goes with an updated version.

@gedkitchener-CT
Copy link
Author

gedkitchener-CT commented Jul 27, 2022

I'm now using R 4.2.1 and Robyn 3.6.3

Using 100 iterations x 5 trials worked fine, both in terms of training the models and producing the output CSVs and plots.

I increased to 2000 iterations x 5 trials, and while robyn_run(...) worked fine, it's the OutputCollect <- robyn_outputs(...) part that's now returning a new error:

>> Exporting pareto results as CSVs into directory...
>> Exporting general plots into directory...
>>> Calculating clusters for model selection using Pareto fronts...
>> Auto selected k = 12 (clusters) based on minimum WSS variance of 5%
>>> Exporting pareto one-pagers into directory...
>> Generating only cluster results one-pagers (12)...
>> Plotting 12 selected models on 6 cores...
  |=========================================                                         |  50%
Failed exporting results, but returned model results anyways:
 Error in serialize(data, node$con): error writing to connection

I should mention that the output CSVs look to be present, but 6 of the one-pagers are missing.

I had a look through the source code, but can't make sense of this new error - any ideas?

@kyletgoldberg
Copy link
Contributor

try using one less core than you have available. serialize issues are due to the parallel processing killing one of the workers.

@gedkitchener-CT
Copy link
Author

@kyletgoldberg That's very handy information - I didn't know that.

Dropping the number of cores appears to have solved this serialise issue.

Thanks again.

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

3 participants