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

use render-current-state via code creates html with failiing images #40

Open
behrica opened this issue Dec 5, 2020 · 7 comments
Open

Comments

@behrica
Copy link
Member

behrica commented Dec 5, 2020

Running this evaluates the notespace and generates html,
but the plots fail with

(ns notespace.cli
  (:require [notespace.actions :as actions]
            [notespace.api :as api]
            [gorilla-notes.core :as gn]
            [notespace.kinds :as k]
            )
  )
(require '[notespace.v3-experiment1-test])
(defn eval-and-realize-a-notespace []
  (let  [anamespace (find-ns 'notespace.v3-experiment1-test)
         ]
    (api/init)
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (gn/render-current-state! "/tmp/out.html")
    )

    (System/exit 0)
  )
@behrica
Copy link
Member Author

behrica commented Dec 5, 2020

Thre is somethinh weired going on.
The above code only produces the non-working html, while started from leiningen:

lein exec -ep "(use 'notespace.cli)(eval-and-realize-a-notespace "notespace.v3-experiment1-test")"

Running the same in repl works:

 (require '[notespace.actions :as actions]
           '[notespace.api :as api]
           '[gorilla-notes.core :as gn]
           '[notespace.kinds :as k]
           )

  (require '[notespace.v3-experiment1-test])
  (let  [anamespace (find-ns 'notespace.v3-experiment1-test)
         ]
    (api/init)
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (gn/render-current-state! "/tmp/out.html")
    )

@behrica
Copy link
Member Author

behrica commented Dec 5, 2020

I diffed the produced html, and it differs in size.
But I could not really see anything in the diff, due to huge lines.

@behrica
Copy link
Member Author

behrica commented Dec 5, 2020

I think the "leiningen" run code does not interpret the kind metadata.
All notes gets rendered as native:

image

vs.

image

I have not seen this before, only the missing plots were obvious.

@daslu
Copy link
Member

daslu commented Dec 5, 2020

Interesting.

It looks like the problem with the first time is that it renders the code when it is not supposed to render.
The markdown-rendered output ("text: ...") seems to appear in both cases.
Right?

@behrica
Copy link
Member Author

behrica commented Dec 6, 2020

I don't know, my screenshot wa maybe not good...
The most visible issue is this:

image

And there is no plot

@behrica
Copy link
Member Author

behrica commented Dec 6, 2020

I tried to a lot of variations of the code, with "sleeps and prints" eveywhere, and the only working workaround is to run evaluation twice:

(require '[notespace.v3-experiment1-test])
(defn eval-and-realize-a-notespace [& args]
  (let  [anamespace (find-ns 'notespace.v3-experiment1-test)]
    (api/init)
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (gn/render-current-state! "/tmp/out.html") )
   (System/exit 0) )

This works reliably.

@behrica
Copy link
Member Author

behrica commented Dec 6, 2020

This test case is even better, as it produces 2 different html files, one bad, one good:

(let  [anamespace (find-ns 'notespace.v3-experiment1-test)]
    (api/init)
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (gn/render-current-state! "/tmp/out_bad.html")
    (actions/act-on-notes! anamespace [actions/eval-note!])
    (gn/render-current-state! "/tmp/out_good.html")
    )

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

2 participants