Fork me on GitHub
#datomic
<
2020-03-24
>
Nolan03:03:46

if an ion fetches an ssm parameter as in the event-example: https://github.com/Datomic/ion-event-example/blob/master/src/datomic/ion/event_example.clj#L40-L48

(def get-params
  ,,,
  (memoize #(,,, (ion/get-params ,,,))))
when can you expect that to get recomputed? e.g. after next deployment, after next upgrade, never, etc.?

em05:03:29

@nolan If you've memoized that function like that it'll update each time the process is cycled so an ion deploy will work to refresh. ion/get-params is just a wrapper around https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParametersByPath.html if you want more details Although it might be a better idea just to write your own version. Be careful about exceeding 10 http://p.ararameters per deploy group, your app might explode if you don't explicitly work around the 10 results limit in this API call, as last I remember ion/get-params does not implement the logic to keep calling next-token until all params are fetched.

wizard 4
4
πŸ‘ 4
πŸ™ 4
clj 4
🀝 4
4
datomic 4
Nolan06:03:32

ah! really appreciate the input @eagonmeng. affirms my suspicions (and hopes, desires, etc. πŸ™), and makes a lot of sense. also appreciate the additional info re: parameter limit, wont be relevant here, but super good to know.

πŸ‘Œ 4
Nolan06:03:47

as a slightly tangential follow-up, does memoizing the call to ion/get-env make any material difference? or is that an in-process access anyway (only really worried about production, if that matters)?

Brian15:03:46

Query question: I have an entity called Interaction with an attribute called :devices which is of cardinality many. Those devices are eids. Given a device eid, I'd like to check to see if that device eid appears in an Interaction's :devices and then return all the other device eids. Here's what I have so far:

'[:find ?devices
  :in $ ?dev-eid
  :where 
  [?interaction :devices ?dev-eid]
  [?interaction :devices ?devices]
 ]
However the problem is that my original ?dev-eid is also inside ?devices . I could filter it out after the query, but I feel like it would be better practice to include that filtering in the query (correct me if I'm wrong on that). Additional info: there are only ever 2 eids in any :devices . How can I remove ?dev-eid from ?devices inside my query? Something like "grab all ?devices which are not equal to ?dev-eid ".

favila16:03:12

Add

[(!= ?devices ?dev-eid)]

Brian16:03:17

Perfect thank you @U09R86PA4! One more (I think) simple thing. I end up only getting a single ?device when I do this. However if I return ?devices ?interaction I end up getting the 4 that I expect (but they are each paired with the ?interaction eid I don't want). It seems like the query just grabs the first one and returns it. How can I have it grab them all?

favila16:03:03

are the four you expect the same?

favila16:03:49

query normally returns sets, so if the same device appears 4 times it won’t matter, you will get one device

favila16:03:22

you can either include :find ?interaction to get the devices per interaction, or use :with ?interaction to include it for the set but then have it removed before returning. queryies with :`with` do not return sets

Brian16:03:41

You were right! The same device appeared multiple times. The data model was slightly different than I expected. I'm getting exactly what I want now =]

Ben Hammond22:03:13

Hi. I'm running datomic-pro-0.9.5697 local transactor and then datomic.peer-server and then datomic.client.api/connect to make the actual connection. It's been working fine for ages; but I've just started to see

Reflection warning, cognitect/hmac_authn.clj:80:12 - call to static method encodeHex on org.apache.commons.codec.binary.Hex can't be resolved (argument types: unknown, java.lang.Boolean).
Reflection warning, cognitect/hmac_authn.clj:80:3 - call to java.lang.String ctor can't be resolved.
warnings and now
Caused by: clojure.lang.ExceptionInfo: No name matching localhost found
{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.anomalies/message "No name matching localhost found", :cognitect.http-client/throwable #error {
 :cause "No name matching localhost found"
 :via
 [{:type .ssl.SSLHandshakeException
   :message "No name matching localhost found"
   :at [sun.security.ssl.Alert createSSLException "Alert.java" 128]}
  {:type java.security.cert.CertificateException
   :message "No name matching localhost found"
   :at [sun.security.util.HostnameChecker matchDNS "HostnameChecker.java" 225]}]
 :trace
 [[sun.security.util.HostnameChecker matchDNS "HostnameChecker.java" 225]
  [sun.security.util.HostnameChecker match "HostnameChecker.java" 98]
  [sun.security.ssl.X509TrustManagerImpl checkIdentity "X509TrustManagerImpl.java" 459]
...
 at datomic.client.api.async$ares.invokeStatic (async.clj:56)
    datomic.client.api.async$ares.invoke (async.clj:52)
    datomic.client.api.sync.Client.connect (sync.clj:71)
    datomic.client.api$connect.invokeStatic (api.clj:118)
    datomic.client.api$connect.invoke (api.clj:105)
errors I'm not aware of changing anything; the SSLHandshakeException makes me wonder if some certificate has expired. I don't see any errors reported on the transactor log or in the peer server console

Ben Hammond23:03:16

Hmmm, naively adding

:validate-hostnames false
didn't seem to help

Ben Hammond23:03:26

haven't tried updating datomic binaries though

Ben Hammond23:03:42

just for reference, I am trying this

(datomic.client.api/connect
  (datomic.client.api/client {:server-type :peer-server,
                              :access-key "myaccesskey",
                              :secret "mysecret",
                              :endpoint "localhost:8998",
                              :validate-hostnames false})
  {:db-name "xiangqi"
   :validate-hostnames false}
  )
and I get
Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:56).
No name matching localhost found

Ben Hammond23:03:31

updating from

com.datomic/client-pro {:mvn/version "0.8.28"}
to
com.datomic/client-pro {:mvn/version "0.9.43"}
seems to have done the trick

Ben Hammond23:03:12

transactor/peer server did not need upgrading; just the client