Class: OpenWFE::TimeExpression
- Inherits:
-
FlowExpression
- Object
- ObjectWithMeta
- FlowExpression
- OpenWFE::TimeExpression
- Includes:
- Rufus::Schedulable
- Defined in:
- lib/openwfe/expressions/time.rb
Overview
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/>.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#applied_workitem ⇒ Object
The workitem received at apply time.
-
#scheduler_job_id ⇒ Object
The job_id in the scheduler for this expression.
-
#scheduler_tags ⇒ Object
The tags (if any) for the job in the scheduler.
Attributes inherited from FlowExpression
#apply_time, #attributes, #children, #environment_id, #fei, #parent_id, #raw_representation
Attributes included from Contextual
Instance Method Summary collapse
-
#cancel ⇒ Object
Makes sure to cancel any scheduler job associated with this expression.
-
#unschedule ⇒ Object
If the expression has been scheduled, a call to this method will make sure it’s unscheduled (removed from the scheduler).
Methods inherited from FlowExpression
#apply, #clean_children, #delete_variable, #dup_environment, #fetch_environment, #fetch_text_content, #get_binding, #get_environment, #get_parent, #get_root_environment, #has_attribute, #initialize, is_definition, is_definition?, #lookup_attribute, #lookup_attributes, #lookup_boolean_attribute, #lookup_comma_list_attribute, #lookup_downcase_attribute, #lookup_ref, #lookup_string_attribute, #lookup_sym_attribute, #lookup_value, #lookup_variable, #lookup_vf_attribute, names, #new_environment, new_exp, #owns_its_environment?, #paused?, #remove_child, #reply, #reply_to_parent, #set_variable, #store_itself, #synchronize, #to_s, #to_yaml_properties
Methods included from Contextual
#get_work_directory, #init_service, #lookup
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Methods included from OwfeServiceLocator
#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator
Methods inherited from ObjectWithMeta
#class_def, meta_def, meta_eval, metaclass
Constructor Details
This class inherits a constructor from OpenWFE::FlowExpression
Instance Attribute Details
#applied_workitem ⇒ Object
The workitem received at apply time
58 59 60 |
# File 'lib/openwfe/expressions/time.rb', line 58 def applied_workitem @applied_workitem end |
#scheduler_job_id ⇒ Object
The job_id in the scheduler for this expression
63 64 65 |
# File 'lib/openwfe/expressions/time.rb', line 63 def scheduler_job_id @scheduler_job_id end |
#scheduler_tags ⇒ Object
The tags (if any) for the job in the scheduler
68 69 70 |
# File 'lib/openwfe/expressions/time.rb', line 68 def end |
Instance Method Details
#cancel ⇒ Object
Makes sure to cancel any scheduler job associated with this expression
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/openwfe/expressions/time.rb', line 74 def cancel synchronize do ldebug { "cancel()..." } unschedule() super() @applied_workitem end end |
#unschedule ⇒ Object
If the expression has been scheduled, a call to this method will make sure it’s unscheduled (removed from the scheduler).
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/openwfe/expressions/time.rb', line 91 def unschedule ldebug { "unschedule() @scheduler_job_id is #{@scheduler_job_id}" } sleep get_scheduler.precision + 0.001 # # make sure not to unschedule before the actual scheduling # got done. get_scheduler.unschedule(@scheduler_job_id) \ if @scheduler_job_id end |