Fork me on GitHub
#datomic
<
2016-09-14
>
PB04:09:58

@robert-stuttaford I did some work with terraform. Found the infrastructure as code to be incredibly valuable

robert-stuttaford04:09:15

we were using CFN for both infrastructure and provisioning before. separating them into two codebases (terraform and ansible) has simplified both sides quite a bit. <strikethrough>decomplection</s> simple wins again!

robert-stuttaford06:09:36

is there a non-hacky way to pipe logs produced by the transactor binary to syslog?

karol.adamiec08:09:57

big thumbs up for terraform as well. If Datomic would support that as alternative way and officialy support terraform modules that would be awesome <wink>

val_waeselynck10:09:18

Having a doubt about the behaviour of datomic.api/transact-async. Does it return (its Future) immediately or is there a blocking part to the call?

val_waeselynck10:09:10

IIUC seems to me transact-async makes an attempt to contact the transactor before returning,

danielstockton10:09:02

Seems to me that might only apply to transact, I'll let someone else answer definitively. You could see what happens when you transact-async and the transactor is down

kurt-yagram12:09:00

Using pull, can I add transaction metadata of a nested entity?

kurt-yagram12:09:05

For example:

{:find [(pull ?e 
        [:con/id
         :con/class
         {:con/items [:item/id {:item/data [...]}]}
        ]) ...]
 :in $ ?cl
 :where [[?e :con/class ?cl]]}
How to add transaction metadata to all item-entities (`:item/id`)?

robert-stuttaford13:09:52

@kurt-yagram you can't reach tx via pull, because txes aren't linked to e via a. d/pull (like d/entity) is about traversing e <=> a relationships. you can reach via d/q clauses (via fourth binding position) or d/datoms (via :tx)

robert-stuttaford13:09:25

in your code, you'd add ?tx after ?cl in your where clause, and then you can do a separate (pull) on that in your find.

kurt-yagram13:09:43

yeah, but that doesn't fetch me the tx's of the items. A separate pull/query is necessary... Thx!

ethangracer14:09:18

are datomic rules evaluated in order? as in, if I have 3 rules with the same name defined in one vector , then the first one is checked first?

ethangracer14:09:24

the behavior I’m seeing would suggest otherwise, but want to be sure I’m not missing something

Ben Kamphaus14:09:54

@ethangracer can you describe how you believe the order would matter in your case?

robert-stuttaford14:09:12

afaik, in the order you've written them

robert-stuttaford14:09:51

looking forward to discovering if i'm mistaken, though 🙂

ethangracer14:09:46

@bkamphaus the database is configured so that I have item templates and item instances (kind of like classes vs objects in OO). So if an item instance has the :item/tag field, I want to get that field instead of getting the :item/tag field on the item template

ethangracer14:09:45

so I wrote the following 2 rules:

‘[[(item-with-attr ?item ?attr ?value)
   [?item ?attr ?value]
   [?item :item/template _]]
  [(item-with-attr ?item ?attr ?value)
   [?item :item/template ?template]
   [?template ?attr ?value]]]

ethangracer14:09:38

the idea being, if the entity is an instance, get me the value on that instance. if the instance doesn’t have that field, then go and get me the attribute on the template

ethangracer14:09:23

the behavior is currently nondeterministic — if I add additional schema, the rule sometimes returns the template attribute (`:item/tag`, in this case) before the instance attribute

Ben Kamphaus14:09:58

“if the instance doesn’t have that field” - rules are not meant to guarantee an order to implicitly handle what you mean to be a conditional evaluation on something not being there (unless there’s a specific not cause). I would use missing http://docs.datomic.com/query.html#missing or a not clause http://docs.datomic.com/query.html#not-clauses explicitly.

ethangracer14:09:50

@bkamphaus awesome, that worked, thank you! if rules don’t guarantee an order to handle conditional evaluation, why can you use multiple rules in place of an or or or-join? Just want to make sure I understand the distinction

Ben Kamphaus14:09:12

because you only have to fulfill one criteria in the or to return true. I guess there could be performance implications for which clause is matched, but any clause should be sufficient to fulfill the criteria.

ethangracer14:09:34

got it, that makes sense

ethangracer14:09:35

doesn’t quite work like or in a programming language then, where it ignores all false values (in order) until finding the first true value

Ben Kamphaus14:09:14

yeah, I don’t want to speak too generally about when order is/isn’t guaranteed but you should always approach the correctness aspect of any query as if order doesn’t matter. Clause ordering typically only matters e.g. within a where clause for performance reasons, filtering the set down to smaller intermediates rather than larger ones.

Ben Kamphaus14:09:07

the or short-circuit behavior you describe where you want the first truthy thing is definitely a different beast. I think with datalog (or even SQL, etc. for that matter) it’s easier to just think of set unions and intersections, etc.

ethangracer14:09:43

ahh, right. rules being literal substitutes for where clauses helps to clarify that distinction. I’m definitely still new to database programming in general, so I appreciate the tip about considering queries in terms of set operations rather than programming constructs.

drankard15:09:09

@jared sorry for the long response time. I tried a lot of different things now, but i still se no metrics in Cloudwatch I have the AWS keys in place and the proxy settings is working for s3 logging, when i uncomment the aws-s3-log-bucket-id, The transactor log is updates in s3 When i unkomment the datomic.lifecycle in logback.xml i se headbeat lines in the transactor log file, but not the metrics HeartbeatMsec format, regular log statements I set all aws and http logs levels to DEBUG and i can see a few lines in the log: com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics

jaret19:09:03

@drankard Datomic reports metrics to Cloudwatch under a separate namespace. At the bottom of the left navigation bar in the CloudWatch dashboard there is a pull down menu (Custom Metrics...). There should be a Datomic namespace there.

jaret19:09:08

@drankard could you supply your transactor logs if that doesn’t do the trick?