Fork me on GitHub
#boot
<
2017-10-24
>
borkdude12:10:02

Is it me or does boot-test not pick up on test-ns-hook?

ben.mumford14:10:48

hi all, i'm trying to run my boot project which requires the sparkling library by gorillalabs. my boot run task: (deftask run "Run the service in an embedded Jetty server." [] (set-env! :resource-paths #(conj % "env/dev/resources")) (set-env! :source-paths #(conj % "env/dev/clj")) (comp (filter-resources) (with-pass-thru _ (require 'classification-server.core :reload-all) ((resolve 'classification-server.core/-main))) (wait))) and i get java.lang.ClassNotFoundException: sparkling.serialization.Registrator org.apache.spark.SparkException: Failed to register classes with Kryo the documentation suggests adding :aot [#".*" sparkling.serialization sparkling.destructuring] but when i add (task-options! aot {:namespace #{'classification-server.core 'sparkling.serialization 'sparkling.destructuring}} ... i get no further

ben.mumford14:10:12

i have tried including the (aot) task in my run task to no avail

alandipert15:10:53

ben.mumford the problem might be related to the fact that classes generated during AOT are not added to the classpath that the kryo stuff runs in

ben.mumford15:10:33

so, question 2. how do i do that?

alandipert15:10:12

i think it depends on how much you want to learn about boot and classpaths today :-)

alandipert15:10:28

the basic idea is, set up the classpath of a pod and then run your code inside the pod instead of at "the top level"

alandipert15:10:13

https://github.com/alandipert/boot-trinkets/blob/master/src/alandipert/boot_trinkets.clj is an example of a similar thing. that run task is for when i have javac in my pipeline, and i want to continuously run the main method of some compiled class

alandipert15:10:39

an advantage of the pod way is that you're kind of running your code "containerized" in these pods, and you can add/remove/change code and not need to restart boot

alandipert15:10:04

the disadvantage is you need to switch to an "application oriented" style where you move away from a REPL and toward an entrypoint function that you run

alandipert15:10:46

personally though, if it were me, i would punt on boot and use whatever the gorillalabs people recommend

alandipert15:10:10

lein i suppose? kryo and its clj wrappers do some wild stuff that has challenged my understanding of java in the past

alandipert15:10:10

full disclosure, the last time i did spark stuff, i gave up on clj entirely and regressed to intellij/scala

alandipert15:10:19

(and it worked out pretty well)

ben.mumford15:10:50

yeah i'd like to stick to boot if possible, all our other applications use boot and i can run the uberjar once built but just not my little boot run command

ben.mumford15:10:25

seems silly to have lein for one project and boot for everything else

alandipert15:10:07

i thought that originally too, but spark changed my outlook

alandipert15:10:36

one way you could simplify your job if you want to stick with boot is just focus on getting the uberjar working, not worry about the run task

alandipert15:10:33

then you could e.g. boot watch build in one terminal and run the uberjar continuously in another, like with the entr command + java

alandipert15:10:12

the major simplification there is the reasoning about pods and classpaths... to just worry about what's in the jar

ben.mumford16:10:07

yeah the jar works fine. i might experiment with the watch thing

qqq16:10:00

is there a way to get boot, under cljs :optimizaions :all, to, instead of writing to main.js, write to main_timestamp.js ? I am running into cloudfront + aws caching issues; and if I got my js files named main_timestamp.js, things would work better

qqq17:10:56

this line here currently writes the output out to main.js:

(cljs :ids #{"main"}
         :optimizations :advanced
         :compiler-options {:source-map-timestamp true})
question: is there a way to configure this to write it out to (format "main_%d.js" (timestamp)) ? due to caching / work flow reasons, I want each main_.js to have a different timestamp

qqq18:10:14

I've got the timestamp part setup;I now need to do a "move main.js main_timestamp.js" -- how do I execute this as a boot task ?

seancorfield18:10:02

We just call to copy files around in our Boot tasks.

seancorfield18:10:36

(and there's to clean up after)

qqq19:10:34

(deftask rename-mainjs []
  (boot.core/with-pre-wrap fileset
    (io/copy (io/file "main.js") (il/file "foo.js"))))

(comp ...
(cljs :ids #{"main"}
         :optimizations :advanced
         :compiler-options {:source-map-timestamp true})
(rename-mainjs)
...)
this doesn't seem to work since the cljs-task writes stuff ot fileset right ?

minikomi02:10:13

Maybe boot.core/mv or use a sift w/ :move?

qqq05:10:50

I ended up using

(sift :move {#"main.js" fname})

chooie20:10:25

How do I use boot’s ‘OPTS’ in the repl? something like: (boot "--version")

alexyakushev20:10:24

Hi folks, how do I exit-error a script cleanly, without printing the stacktrace? The only thing I can find is https://github.com/boot-clj/boot/issues/405 which kinda says the issue is solved but I don't understand how.

seancorfield20:10:51

@alexyakushev I don't believe you can. That's just part of Boot's "charm"... 🙂

alexyakushev20:10:32

That's quite charming 😄

juhoteperi20:10:20

It is possible 🙂

juhoteperi20:10:15

(throw (ex-info "..." {:boot.util/omit-stracktrace? true})

alexyakushev21:10:46

@juhoteperi Thanks, but it still prints the stacktrace for me:(

Boot.main                         Boot.java:  258
                                                        ...
                                              boot.App.main                          App.java:  491
                                           boot.App.runBoot                          App.java:  399
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke       ClojureRuntimeShimImpl.java:  150
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke       ClojureRuntimeShimImpl.java:  159
                                                        ...
                                            boot.main/-main                          main.clj:  206
                                         boot.main/-main/fn                          main.clj:  206
                                                        ...
                                         boot.user/eval1138  boot.user7227065426553824320.clj:   35
                                                        ...
                                      boot.user/eval1116/fn  boot.user7227065426553824320.clj:   31
                                         clojure.core/apply                          core.clj:  646
                                                        ...
                                      boot.user/eval1094/fn  boot.user7227065426553824320.clj:   27
                                                        ...
                                      boot.user/eval1033/fn  boot.user7227065426553824320.clj:   23
                                 boot.user/exit-error-clean  boot.user7227065426553824320.clj:   19
                                       clojure.core/ex-info                          core.clj: 4617
clojure.lang.ExceptionInfo: Some tests have failed.
    boot.util/omit-stracktrace?: true
clojure.lang.ExceptionInfo: Some tests have failed.
    file: "/tmp/boot.user7227065426553824320.clj"
    line: 35

seancorfield22:10:57

@alexyakushev I've never been able to get that to work either /cc @juhoteperi