Fork me on GitHub
#datomic
<
2020-02-20
>
maxt08:02:15

@marshall Thank you! I especially like the log list command. Would those commands also be available to call from a repl? That would be my prefered way of working. Then I don't need to have another window open, I can save some startup time, and I don't have to parse text to process the output further.

maxt15:02:03

Turns out using it from the REPL works great

(require 'datomic.tools.ops)
  (datomic.tools.ops.cloud/list-systems {})
  (datomic.tools.ops.system/list-instances {:system "example"})
  (datomic.tools.ops.log/events {:group        "example"
                                 :minutes-back 10
                                 :tod          (java.util.Date.)})

pez11:02:55

Someone else tried to deploy on-prem in AWS eu-north-1? I get an error Not a supported dynamodb region: eu-north-1 - (You'll never learn).

marshall12:02:41

The included launch scripts dont currently support that region. You can likely provision and launch manually there. I will also look into adding support for the region in an upcoming release

pez12:02:55

In our case we get the error message when the peer is trying to connect, so this seems to go deeper than the launch script.

marshall14:02:07

ah; i think i know what the issue is; one minute

marshall14:02:31

I believe I have a workaround that will work for you.

In your transactor properties file, change the protocol to ddb-local:

protocol=ddb-local

Then comment out the aws-dynamodb-region line:
#aws-dynamodb-region=

Finally, set the aws-dynamodb-override-endpoint to the address of the DDB endpoint:
aws-dynamodb-override-endpoint=

The use of ddb-local as the protocol will allow the system to honor the override configuration.

Similarly, you will need to use the ddb-local URI for your peer: 

pez14:02:32

Thanks a lot! Right now we're moving things back to eu-central-1, but we might try this again later this week. Will let you know if we do and how we fare, if so.

marshall14:02:01

I will also add a feature request for region support for that region

❤️ 4
pez14:02:10

That would certainly help us. We will probably stick with on-prem on AWS for a while, and we serve only Sweden.

maxt15:02:03

Turns out using it from the REPL works great

(require 'datomic.tools.ops)
  (datomic.tools.ops.cloud/list-systems {})
  (datomic.tools.ops.system/list-instances {:system "example"})
  (datomic.tools.ops.log/events {:group        "example"
                                 :minutes-back 10
                                 :tod          (java.util.Date.)})

marshall15:02:33

We don’t currently support running the tools from a REPL; caveat emptor so to speak

uwo16:02:59

When overriding the default table name in a metaschema, is that name then used to match with Datomic attributes and determine the columns for the associated table? (https://docs.datomic.com/cloud/analytics/analytics-metaschema.html#name-option)

uwo22:02:24

just to follow up, the answer looks to be no. As in the name-opt isn't used to match attributes whose munged namespace would match. Need to use :include to capture them. (let me know if I'm missing something!)

mdhaney16:02:57

I’m trying to automate my Ion deployments with a Github workflow, but I can’t figure out how to handle polling for the deployment status. I was wondering if anyone else has done this, or even with a different CI tool how you handled the polling.

maxt17:02:06

I'm doing it on circle CI. This is my deploy function

;; Inspired by 
(defn ions-release
  "Do push and deploy of app.  Supports stable and unstable releases.  Returns when deploy finishes running."
  [{:keys [group] :as args}]
  (try
    (let [push          (requiring-resolve 'datomic.ion.dev/push)
          deploy        (requiring-resolve 'datomic.ion.dev/deploy)
          deploy-status (requiring-resolve 'datomic.ion.dev/deploy-status)]
      (println "Pushing" args)
      (let [{:keys [dependency-conflicts deploy-groups] :as push-data} (push args)]
        (assert (contains? (set deploy-groups) group) (str "Group " group " must be one of " deploy-groups))
        (let [delay-between-retries 1000
              deploy-args           (merge (select-keys args [:creds-profile :region :uname :group])
                                           (select-keys push-data [:rev]))
              _                     (println "Deploying" deploy-args)
              deploy-data           (deploy deploy-args)
              deploy-status-args    (merge (select-keys args [:creds-profile :region])
                                           (select-keys deploy-data [:execution-arn]))]
          (when dependency-conflicts
            (clojure.pprint/pprint dependency-conflicts))
          (println "Waiting for deploy" deploy-status-args)
          (loop []
            (let [status-data (deploy-status deploy-status-args)]
              (if (= "RUNNING" (:code-deploy-status status-data))
                (do
                  (print ".")
                  (flush)
                  (Thread/sleep delay-between-retries) (recur))
                (do (println)
                    status-data)))))))
    (catch Exception e
      {:deploy-status "ERROR"
       :message       (.getMessage e)})))

Nico16:02:59

I have an attribute that has a cardinality of many, how do I test in a query that all entries in it aren't equal to a certain thing?

Nico16:02:45

I can do [?e :tags ?t] [(not= :tags [whatever])] but that returns items that have the tag I don't want, because they also have other tags

Nico17:02:23

I just realised not clauses were a thing, but that still doesn't completely solve the problem

favila17:02:58

If you are using on-prem, call a function that checks; this is very tedious in pure datalog

Nico17:02:27

ah ok, thanks

favila17:02:43

An on-prem function implementation looks something like this:

(defn not-any-matching-eav? [db e a test-v]
  (zero? (->> (datomic.api/datoms db :eavt e a test-v)
              (bounded-count 1))))

shaunxcode19:02:45

is there any way with the pull syntax to indicate you only want the single value (v.s. a collection containing one value). With query we can do [:find ?x . :in ....] is there something similar (only thing I could find in docs is ability to indicate limit). e.g. what about the case where you know there is only one term e.g. [:person/id [{:person/_child [:person/id]} :as :person/parent]] and I do not want :person/parent to be "boxed"? Like I would like the result to be [{:person/id :x :person/parent {:person/id :y}}] not [{:person/id :x :person/parent [{:person/id :y}]}]

uwo22:02:24

just to follow up, the answer looks to be no. As in the name-opt isn't used to match attributes whose munged namespace would match. Need to use :include to capture them. (let me know if I'm missing something!)

csm23:02:27

I’m thinking of using a tuple of two instants to represent a validity period, and a query would look something like [:find ?cap :in $ :where [?cap :capability/period ?period] [(ground (java.util.Date.)) ?now] [(first ?period) ?starts] [(second ?period) ?ends] [(< ?starts ?now)] [(< ?now ?ends)]]. Is that an appropriate use of tuples? Is first and second the right way to pull those values out?