How to use the croniter.croniter.croniter function in croniter

To help you get started, we’ve selected a few croniter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opennode / waldur-mastermind / src / waldur_core / core / models.py View on Github external
def update_next_trigger_at(self):
        tz = pytz.timezone(self.timezone)
        dt = tz.normalize(django_timezone.now())
        self.next_trigger_at = croniter(self.schedule, dt).get_next(datetime)
github opennode / waldur-core / waldur_core / core / models.py View on Github external
def update_next_trigger_at(self):
        base_time = django_timezone.now().replace(tzinfo=pytz.timezone(self.timezone))
        self.next_trigger_at = croniter(self.schedule, base_time).get_next(datetime)
github opennode / waldur-core / nodeconductor / backup / models.py View on Github external
def _update_next_trigger_at(self):
        """
        Defines next backup creation time
        """
        base_time = django_timezone.now().replace(tzinfo=pytz.timezone(self.timezone))
        self.next_trigger_at = croniter(self.schedule, base_time).get_next(datetime)
github gawel / aiocron / aiocron / __init__.py View on Github external
def initialize(self):
        """Initialize croniter and related times"""
        if self.croniter is None:
            self.time = time.time()
            self.datetime = datetime.now(get_localzone())
            self.loop_time = self.loop.time()
            self.croniter = croniter(self.spec, start_time=self.datetime)
github igalarzab / sqjobs / sqjobs / contrib / django / djsqjobs / models.py View on Github external
def get_next_utc_execution(self):
        tz = pytz.timezone(self.timezone)

        if not self.next_execution:
            base = tz.normalize(datetime.now(tz) - timedelta(minutes=1))
        elif self.skip_delayed_jobs_next_time:
            base = tz.normalize(datetime.now(tz))
        else:
            base = tz.normalize(self.next_execution.replace(tzinfo=pytz.utc))

        cron = croniter(self.schedule, base)

        return cron.get_next(datetime).astimezone(pytz.utc)