Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 23 21:23
    Subtletree commented #30
  • Sep 23 13:55
    jmettraux closed #30
  • Sep 23 13:55
    jmettraux commented #30
  • Sep 23 13:54

    jmettraux on master

    Set node['tree'] when rewriting… (compare)

  • Sep 23 04:39
    Subtletree edited #31
  • Sep 23 04:37
    Subtletree edited #31
  • Sep 23 04:24
    Subtletree edited #31
  • Sep 23 04:23
    Subtletree edited #31
  • Sep 23 04:23
    Subtletree opened #31
  • Sep 20 05:42
    jmettraux commented #30
  • Sep 20 03:45
    Subtletree commented #30
  • Sep 20 03:41
    jmettraux edited #30
  • Sep 20 03:41
    jmettraux assigned #30
  • Sep 20 03:38
    Subtletree opened #30
  • Sep 15 22:44
    jmettraux commented #29
  • Sep 15 22:26
    Subtletree commented #29
  • Sep 09 23:52
    jmettraux closed #29
  • Sep 09 23:52
    jmettraux commented #29
  • Sep 07 07:20
    jmettraux commented #29
  • Sep 07 07:18

    jmettraux on master

    Fix parsing of "set original 1"… (compare)

John Mettraux
@jmettraux
oh great
ah, yes, it is, we're safe
Ryan Scott
@Subtletree

Hey John, How was RubyKaigi??

Is there a mechanism for 'fast forwarding' a flor process? i.e for testing purposes. I guess one method would be to stub 'user' taskers to reply immediately and just run the whole process.

John Mettraux
@jmettraux
Hello Ryan, the RubyKaigi was fun, but I just attended one day (four talks) and then headed back home to meet visiting friends
yes, you are right, stubbed user taskers may work
another way would be to reach the desired state, then dump the records and reuse them in tests
so that you're immediately in the desired state
but that doesn't cover what's around flor
and it's a pain to adapt when change strikes
Ryan Scott
@Subtletree
Hmm that could work though, you'd need to dump the flor records too
John Mettraux
@jmettraux
yes, the flor tables
Ryan Scott
@Subtletree
But yeah maybe I'll look at stubbing the taskers initially. Can see bugs being hidden by the dumped state becoming stale
John Mettraux
@jmettraux
+1
Ryan Scott
@Subtletree
Thanks! Just thought I'd run that past you
John Mettraux
@jmettraux
you're welcome
another "middle of the road" idea would be to dump the execution in a before :all, then use the dump in each before :each so that you only pay 1 execution and then you have a starting point ready for a set of specs
so that you're adapting each time
Ryan Scott
@Subtletree
I like it :grinning: will let you know how I go
John Mettraux
@jmettraux
:-)
Ryan Scott
@Subtletree

Think i've ended up with quite a tidy pattern.

When a user completes a task the task looks up the associated tasker and calls an on_complete method.

So to stub out user taskers and make them reply appropriately I'm doing

module AutoCompleteTasker
  def task
    super
    on_complete
    reply
  end
end

class ClientTasker::StartApplicationForm
  prepend AutoCompleteTasker
end
John Mettraux
@jmettraux
nice and clean, well done!
If, at some point, you'd feel like adding to https://github.com/floraison/flor/tree/master/doc a piece of documentation about that, that'd be much welcome
John Mettraux
@jmettraux
@Subtletree Hello, I think I will add a #dump(exid_or_domain_or_nil, io=nil) and a #load(io_or_string, domain_filter=nil) methods to the flor scheduler, it should cover part of the "test fast forward" needs you expressed
Ryan Scott
@Subtletree
sounds pretty cool! Let me know if I can help with testing
Definitely keen to make some additions to the docs. Turned my tasker stub into a helper
  module AutoReplyTasker
    def task
      super
      reply(on_complete) unless @has_replied
    end

    def reply(message = @message, force = false)
      @has_replied = true
      super(message, force)
    end
  end

  def autoreply_tasker(tasker_class)
    cloned_task = tasker_class.clone
    cloned_task.prepend(AutoReplyTasker)
    stub_const(tasker_class.to_s, cloned_task)
  end
John Mettraux
@jmettraux
nice!
Ryan Scott
@Subtletree

Hey John! Quick question about timeout's, Is it possible to have a timeout which doesn't cancel the node

john 'review application' timeout: '3d'
  on_timeout: (def \ email 'send reminder to john')

After 3 days remind John to review the application and keep the review_application task for john to perform.

Ryan Scott
@Subtletree

I'm trying to look into the above myself, but I'm getting stuck on some flor internals, this is where I am so far.

When review_application is reached the timeout is saved to flor_timers.
Every tick the timers are checked to see if any are ready.
After 3d a tick triggers the timer and puts it's message into flor_messages table
This message is picked up by the scheduler and eventually passed to Executor#process

After this I get lost, where does the message type get determined and routed to it's specific procedure?

Ryan Scott
@Subtletree
https://github.com/floraison/flor/blob/063b7da4a5e220148ccb83b84625f046db42ced0/lib/flor/core/executor.rb#L454
Here the method name at message['point'] is invoked, in this case trigger
Ryan Scott
@Subtletree
This returns the trigger's embedded message which is a cancel and flavour = timeout
Maybe a new timer/on_timer combination would more sense
John Mettraux
@jmettraux
@Subtletree hello, that's a good point
in the mid term, what I want is something like:
john 'review application' timers: '3d: reminder, 7d: timeout'
Ryan Scott
@Subtletree
ah yeah that looks perfect
I was just having a go at implementing timer/on_timerbut I think your suggestion is beyond me
John Mettraux
@jmettraux
roughly:
john 'review application'   
  sequence flank                  
    sleep '3d'                                                                  
    send_reminder
or
sequence
  sequence flank                  
    sleep '3d'                                                                  
    send_reminder                                                               
  john 'review application'
the "flanking" sequence gets cancelled as soon as its parent node is done
Ryan Scott
@Subtletree
That is actually perfect, because my usecase would have another 'user' task in the flanking branch which would need to be cancelled if the application is reviewed
John Mettraux
@jmettraux
if you give me a bit of time, I could implement the timers: attribute, taking inspiration from ruote, I strongly want something like that for flor, a flow of having echelon of flanking events
but flank might help in the meantime (or as you seem to indicate, be better suited)
Ryan Scott
@Subtletree

Yeah my usecase is actually more like

john 'review application'   
  sequence flank                  
    sleep '3d'                                                                  
    alice 'remind john'
    email 'send reminder email' if ret = 'email' # alice can choose to remind john in person

so flanking might be my new favourite haha

John Mettraux
@jmettraux
ok, I'll try my best to help you with that. I'm on the Western Europe timezone until the 8th of July actually.
Ryan Scott
@Subtletree
Ah nice. I'll have a go at using flank now and let you know how I go. Thanks for your input as always!
John Mettraux
@jmettraux
You're welcome! It's a nice to tinker around with you
Ryan Scott
@Subtletree
:grinning: :thumbsup: