Module: PerfectSched
- Defined in:
- lib/perfectsched.rb,
lib/perfectsched/task.rb,
lib/perfectsched/error.rb,
lib/perfectsched/model.rb,
lib/perfectsched/client.rb,
lib/perfectsched/engine.rb,
lib/perfectsched/runner.rb,
lib/perfectsched/worker.rb,
lib/perfectsched/backend.rb,
lib/perfectsched/version.rb,
lib/perfectsched/schedule.rb,
lib/perfectsched/application.rb,
lib/perfectsched/signal_queue.rb,
lib/perfectsched/blocking_flag.rb,
lib/perfectsched/signal_thread.rb,
lib/perfectsched/daemons_logger.rb,
lib/perfectsched/application/base.rb,
lib/perfectsched/schedule_metadata.rb,
lib/perfectsched/application/router.rb,
lib/perfectsched/backend/rdb_compat.rb,
lib/perfectsched/application/decider.rb,
lib/perfectsched/schedule_collection.rb,
lib/perfectsched/application/dispatch.rb
Overview
PerfectSched
Copyright © 2012 FURUHASHI Sadayuki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing and
limitations under the License.
Defined Under Namespace
Modules: Application, Backend, BackendHelper, IdempotentError, Model, ScheduleMetadataAccessors Classes: AlreadyExistsError, AlreadyFinishedError, Client, ConfigError, Engine, IdempotentAlreadyExistsError, IdempotentAlreadyFinishedError, IdempotentNotFoundError, NotFoundError, NotSupportedError, PreemptedError, ProcessStopError, Runner, Schedule, ScheduleCollection, ScheduleError, ScheduleMetadata, ScheduleWithMetadata, Task, Worker
Constant Summary collapse
- VERSION =
"0.8.10"- SignalQueue =
PerfectQueue::SignalQueue
- BlockingFlag =
PerfectQueue::BlockingFlag
- SignalThread =
PerfectQueue::SignalThread
- DaemonsLogger =
PerfectQueue::DaemonsLogger
Class Method Summary collapse
- .cron_time(cron, timestamp, timezone) ⇒ Object
- .next_time(cron, before_timestamp, timezone) ⇒ Object
- .open(config, &block) ⇒ Object
Class Method Details
.cron_time(cron, timestamp, timezone) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/perfectsched.rb', line 73 def self.cron_time(cron, , timezone) begin tab = CronSpec::CronSpecification.new(cron) rescue raise ArgumentError, "invalid cron format: #{$!}: #{cron.inspect}" end begin tz = TZInfo::Timezone.get(timezone) if timezone rescue raise ArgumentError, "unknown timezone: #{$!}: #{timezone.inspect}" end ts = ( + 59) / 60 * 60 while true t = Time.at(ts).utc t = tz.utc_to_local(t) if tz if tab.is_specification_in_effect?(t) return ts end ts += 60 # FIXME break end end |
.next_time(cron, before_timestamp, timezone) ⇒ Object
98 99 100 |
# File 'lib/perfectsched.rb', line 98 def self.next_time(cron, , timezone) cron_time(cron, +1, timezone) end |
.open(config, &block) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/perfectsched.rb', line 58 def self.open(config, &block) c = Client.new(config) begin q = ScheduleCollection.new(c) if block block.call(q) else c = nil return q end ensure c.close if c end end |