Class OpenWFE::TimeExpression
In: lib/openwfe/expressions/time.rb
Parent: FlowExpression

A parent class for CronExpression and SleepExpression, is never used directly. It contains a simple get_scheduler() method simplifying the scheduler localization for <sleep/> and <cron/>.

Methods

Included Modules

Rufus::Schedulable

Attributes

applied_workitem  [RW]  The workitem received at apply time
scheduler_job_id  [RW]  The job_id in the scheduler for this expression
scheduler_tags  [RW]  The tags (if any) for the job in the scheduler

Public Instance methods

Makes sure to cancel any scheduler job associated with this expression

[Source]

    # File lib/openwfe/expressions/time.rb, line 74
74:         def cancel
75:             synchronize do
76: 
77:                 ldebug { "cancel()..." }
78: 
79:                 unschedule()
80: 
81:                 super()
82: 
83:                 @applied_workitem
84:             end
85:         end

If the expression has been scheduled, a call to this method will make sure it‘s unscheduled (removed from the scheduler).

[Source]

     # File lib/openwfe/expressions/time.rb, line 91
 91:         def unschedule
 92: 
 93:             ldebug { "unschedule() @scheduler_job_id is #{@scheduler_job_id}" }
 94: 
 95:             sleep get_scheduler.precision + 0.001
 96:                 #
 97:                 # make sure not to unschedule before the actual scheduling
 98:                 # got done.
 99: 
100:             get_scheduler.unschedule(@scheduler_job_id) \
101:                 if @scheduler_job_id
102:         end

Protected Instance methods

looks up potential scheduler tags in the expression attributes

[Source]

     # File lib/openwfe/expressions/time.rb, line 110
110:             def determine_scheduler_tags
111: 
112:                 st = lookup_attribute :scheduler_tags, @applied_workitem
113: 
114:                 @scheduler_tags = if st 
115:                     st.split(",").collect { |s| s.strip }
116:                 else
117:                     []
118:                 end
119:                 @scheduler_tags << self.class.name
120:             end

[Validate]