IRC Logs for #circuits Monday, 2014-10-06

prologictry it and find out :)00:01
prologicbasically a Timer fires a given event at a specif interval00:01
prologicor exact date/time (using datetime)00:01
prologicand optionally persists the timer00:01
prologicso the event itself can point to arbitrary channels00:02
robert_well, this actually needs to be a bit like cron, hmm... I will probably need to wrap it then in something that can keep track of events individually, then.00:03
robert_like, components fire at different times.00:04
prologicit would not be very difficult to do00:07
prologicthe low-level stuff is there00:08
robert_for instance, there's the mailer which runs every 30 seconds, the cache manager which runs every 10 minutes and so on and so-forth.00:08
prologicwhat do you think?00:18
robert_Looks like you ripped off bitbucket a bit. :p00:19
prologicit's an oss bootstrap theme I dripped off00:20
prologicclassic admin theme iirc00:20
robert_so, what's arrow?00:21
prologicThis is what my devices.yml configuration looks like right now00:21
prologicThe plan is to use this to populate the UI that you see there00:21
prologicI'm unsure that I'll be able to reasonably "discover" and "detect resources/apis" of my devices since many of them have limited memory so can't store very complex software (e.g: Arduino Uno, TinyDuino)00:22
prologicI probably can for my Arduino Yun's00:22
prologicarrow is my home router :)00:23
robert_aha, I see.00:24
prologicno thoughts/feedback? :)00:31
prologicthis is still very much early days what I'm doing here at home00:31
prologicbut the chicken coup itself works00:31
prologicalbeit via a couple of cron jobs on my desktop (for now)00:31
prologicbut it works well so far (3 days and counting)00:31
prologiccompletely self-sufficient00:32
prologicsolar and battery powered00:32
robert_It looks nice. How do you plug stuff into it?01:41
robert_like, you could use the loader implement a sort of manager page plug-in model, or something.01:46
robert_prologic: still there?01:59
robert_prologic: how difficult would it be to implement pub/sub using Circuits?02:17
prologicsorry was busy hacking away02:20
prologicfor now I have nfi what I'm doign02:20
prologicthere are many issues to solve02:20
robert_lol, ah.02:20
prologicbut ideally yes02:20
prologicyou'd register new devices02:20
prologicor discover them02:20
prologicprobably the former02:20
prologicrobert_, circuits is pub/sub02:20
prologic@handler == subscribe02:21 == publish02:21
robert_oh, yeah. herp.02:21
robert_okay, so one thing that I need to implement is a generalized event logger.02:22
prologicthere is already one :)02:23
prologicin fact it understands how to use logging.logger02:23
prologiccheck out how I do that in charla and udns02:23
robert_yeah, but I just want straight logging, not debugging or event tracing. :p02:23
robert_oh, so it doesn't have to do component tracing and the like?02:27
prologicI don't understand :)02:27
prologiclogging is logging02:27
prologicdo it however you want :)02:27
prologicI often do either or; or both02:28
prologici.e: plain ol logging02:28
prologicor using Debugger02:28
prologicor both02:28
robert_yeah, but your Debugger logs too much by default.02:28
robert_like, I only need that much when I'm developing it; I don't need that in a production environment. :p02:29
robert_prologic: so one thing that I need to be able to do is log from one event source exclusively until it's another component's turn to log.02:36
robert_prologic: sorry to keep bugging you. :p03:26
prologicI guess I don't understand the use-case :)03:50
prologicI would just use the standard python logger03:50
prologicideally someone would write a new that is truly asynchronous and compatible with the Python logger API03:51
robert_the use case is so that each component gets its turn logging information so that you don't get information mixed up when it's logging an error from one particular piece of the application.04:03
prologicthe solution to this is to use a different context per component04:22
prologicwhich the standard python loger provides04:22
robert_a different context?04:28
robert_hm, what's
robert_I don't see it anywhere.05:12
robert_ImportError: No module named ''05:14
robert_unless you meant that Logger doesn't exist. :p05:14
robert_prologic: so is there a way I can initialize a set of Components first and then eveything else?05:22
robert_prologic: ping? lol05:40
robert_I'm guessing not? lol05:47
prologicwe used to have one05:56
prologicbut it sucked :)05:56
prologicit wasn't very asynchronous :)05:56
prologicinitialize a set of components05:57
prologicthen some other set05:57
prologicuse events :)05:57
prologicuse the force :)05:57
prologichow you orchestrate event flows is entirely up to the app developer :)05:57
robert_well, it seems to all be initialized at once.06:09
robert_it all seems to happen after my application is started()06:10
prologicyeah no that's what I mean06:13
prologicregister a subset of your components at startup06:14
prologicand register the rest later06:14
prologicit's up to you how you structure the events :)06:14
robert_yeah; I'm registering a handful during init()06:14
robert_which seems well and good06:14
robert_but then everything happens "after" startup()06:14
robert_or does it matter?06:14
robert_because if they're registered later, they should be able to get the information they want06:15
prologicthere is nothing circuits imposes on you per say06:19
prologicyou have components, ways to regsiter them into graphs06:19
prologicand ways of creating events and reacting to them06:19
prologicit's up to you how you structure things :)06:19
robert_my whole thing is that my EventLog (I'll use a python logger under-the-covers) registers a handful of Events for when I start up the scheduler tasks.06:20
prologicremember there are ways of firing an event when one has fully completed06:20
prologic(.complete = True)06:20
prologicor when one has finishes successfully (.success = True)06:20
prologicyou can also "wait" for an event complete (.wait)06:20
prologicor call an event synchronously (.call)06:20
robert_I just don't want things to be initialized out-of-order is all. :D06:21
prologicyou need to control that order :)06:21
prologicthe order is defined by your app06:21
prologiccircuits internally uses a FIFO queue06:22
prologicso the first fired event is the first handled eveent06:22
robert_yeah. so I start an event with complete = false06:22
robert_and when I'm finished, I throw the switch and .complete = true06:22
robert_or something?06:22
prologicok so there are several feedback attributes you can set on an event class06:22
prologicsuccess, failure and complete06:23
prologicthey fire an event such as foo_success06:24
prologicor foo_complete06:24
prologicor foo_failure06:24
prologicon foo's completion, success and failure respectively06:24
robert_does started have a complete state?06:25
robert_.. and it doesn't. :p06:26
robert_actually, wait.06:26
robert_you created this, so you can help me figure out how best to handle this06:26
robert_when I load a component, I want to initialize it explicitly06:27
prologicno it doesn't06:28
prologicit could but it's never deemed necessary06:28
robert_ah, I see.06:28
robert_take the follwoing:06:28 = 'my_component_name'06:28
prologicso do it? :)06:29
prologicwith kdb's plugin architecture06:29
prologicI load components dynamically at runtime06:29
prologiccreate an instance of the component06:29
prologicoptionally passing in *init_args, and **init_kwargs06:30
prologicand register it06:30
robert_ <-- prologic, here's what I want to do.06:38
robert_ -- updated. ;p06:39
robert_:p **06:39
prologicand why can't you do what you want?06:42
prologicI'm still a bit confused06:42
robert_I guess I'm too used to being in Ruby for too long.06:44
robert_I go back and forth with different languages and I coded myself into a deadlock a few days ago.06:45
robert_I suppose I'm paranoid that I'll do the same here. :p06:45
prologictry explaining this another way :)06:45
prologicinitializing a component separately is not a problem06:45
prologicat least ihmo06:46
prologicand by init I mean06:46
prologicwhere Foo is06:46
prologicclass Foo(Component):06:46
prologic   ...06:46
robert_Oh, I'm using Loader()06:46
robert_also, you should let me set paths by firing a loader event06:47
robert_so I don't have to initialize Loader manually.06:48
prologicso Loader provides several things06:48
prologicand paths06:48
prologicall part of it's constructor06:48
prologicit's actually a really simple component06:49
prologicand only support file paths at this time06:49
robert_yeah, I wanted to take advantage of auto-registration and just fire an event to update the paths it had registered. :D06:49
robert_oh, wait, nevermind.06:51
robert_I can tackle this a different way. :D06:51
robert_just and do it that way.06:52
prologicsure :)06:53
prologicif component_init is an event handler06:53
prologicI think I've finalized on the structure of my UI and API(s)07:01
*** Osso has joined #circuits07:15
prologicheya Osso :)07:18
robert_so this is for circuits.web?07:24
robert_like, for example, this is the equivalent of the Django manager app, only not so bloated?07:25
robert_OH, prologic- I'm going to be using for filesystem monitoring; how do I use Workers again? do I just subclass one?07:38
prologicrobert_, sorry what?07:51
prologiccircuits has file system monitoring07:51
robert_awesome. where/how do I use it?07:51
prologicthere's an example of it in examples/07:56
robert_sweet. :D07:58
robert_and my event logging code will be much simpler here. :D07:59
robert_okay, so this is the one sticky point, I've always wrestled with this.08:18
robert_in your "Events as result collectors", I need for the event handler to set the "result" to false.08:23
robert_prologic: please and thanks. :D08:24
prologicso return False08:26
prologicbasically the value of an event works something like this:08:26
prologicif there is only 1 event handler for an event08:26
prologicit's value is the return value of the event handler08:26
prologicif there are multiple handlers for an event08:26
prologicyou get a list as the value of that event08:27
prologicbtw thinking of releasing circuits 3.0.1 with some bug fixes soon08:27
robert_awesome. :D08:28
robert_well, I'd like to utilize event_success and event_failure08:28
prologicyou can08:30
prologicdef foo(...):08:30
prologic   ...08:30
prologicdef foo_success(...):08:30
prologic   ...08:30
robert_but I can't set foo.success from the code handling the event though, can I?08:30
prologicthink of the feedback events as analogous to defferads callback and errback08:31
prologicyou can08:31
prologicas long as it wasn't already fired08:31
prologice = Event.create("foo")08:31
prologice.success = True08:31
robert_yeah; the code handling the event needs to be able to set/clear success for it to be useful, because then you can tell if the event succeeded or failed. :p08:32
robert_like in the website example08:32
robert_Identify will always be true.08:33
robert_.. OH.08:33
robert_wait, that makes no sense like that.08:34
robert_oh, I see.08:35
robert_then .complete would probably be more fitting. :p08:35
prologicok so no08:37
prologicif you handle the event08:37
prologicand set event.success = true08:37
prologicit will have no effect08:37
prologicthis happens in the core of the main event dispatcher08:37
prologicso it has to be set __before__ it is fired/handled08:37
robert_and it's probably that way because of how the python package multiprocessing works.08:41
prologicbbs dinner08:42
robert_this is so weird.08:55
robert_my event logger won't run if I have a logging.Filter in my code; but it runs if I comment it out.08:58
robert_prologic: back?10:00
prologicyeah sort of10:04
robert_ah, good.10:04
robert_including a logging.Filter makes my module fail to import.10:05
robert_oh, nevermind.10:06
robert_yeah, it was me.10:07
robert_okay, here we go.10:16
robert_ERROR <handler[*.load] (Loader.load)> (<load[*] ('EventLog' )>) (<class 'AttributeError'>): AttributeError("'EventLog' object has no attribute 'self'",)10:16
robert_so I can't pass self to a non-component?10:18
robert_oh, nevermind me again.10:18
robert_prologic: so how would you implement a scheduler using circuits?10:22
robert_oh, I see.10:34
robert_I don't need to create a scheduler.10:34
robert_but I can, if I want.10:35
*** ninkotech has quit IRC11:09
*** ninkotech__ has joined #circuits11:15
robert_prologic: the issue I'm having right now is that it won't log to the screen correctly.11:39
prologicrobert_, you keep answering all your own questions11:50
prologicI feel sometimes you do too many things in too many technologeis/langauges11:50
prologicyou don't need a scheduler if you're using circuits :)11:51
robert_lol, yeah.11:51
robert_well notsomuch a scheduler11:51
robert_but something that throws events at intervals defined by the incoming components.11:51
robert_prologic: that's what I have so far.11:52
robert_prologic: And it's not logging correctly. That's one of my main issues so far.11:52
robert_EventLog doesn't appear to be doing anything.11:53
robert_and application.log is empty.11:53
prologicyou're getting things out of order?11:53
prologicalso "events at scheduled times"11:54
prologicthat's why circuits.core.timer.Timer exists :)11:54
prologicdebug it with Debugger() :)11:54
prologicI have to go to bed :)11:54
prologicgood luck, talk more in the morning :)11:54
robert_okay, lol11:54
pdurbinprologic: so my talk went well. or so I was told :)11:56
prologicpdurbin, oh that's wonderful :)12:12
prologicpost a link when the video isup12:12
prologicI'd like to see how you went :)12:12
prologicg'night all12:12
pdurbinprologic: hmm, I'm not sure it was recorded after all, but here are the slides: BOF5619 Lean Beans (are made of this): Command pattern vs. MVC -
*** ninkotech has joined #circuits15:32
robert_prologic: oh, inotify doesn't work on freebsd. :P16:52
*** koobs has quit IRC17:19
*** koobs has joined #circuits20:06
prologicpdurbin, thanks I'll take a look :)20:35
prologicrobert_, what does bsd use for file system notifications? inotify is linux only afaik20:35
pdurbinkqueue, maybe22:11
robert_prologic: looks like kqueue.22:14
*** Workster has quit IRC22:23
*** ninkotech__ has quit IRC22:28
*** ninkotech__ has joined #circuits22:29
prologickqueie? really?23:09
prologicwell we have a poller for that23:09
prologicbut how do you watch for file system changes with kqueue?23:09
prologicI suppose we could write a component for kQueue-based file system notifications23:09
prologicofc one could write a wrapper component for watchdog too :)23:09
pdurbinmaybe libevent23:52

Generated by 2.11.0 by Marius Gedminas - find it at!