EventEntry

class beatdrop.entries.event_entry.EventEntry

Bases: ScheduleEntry

Event schedules are for a one time event.

After they run once they are disabled. sched.enabled = False

Parameters:
  • key (str) – A unique key for the schedule entry.

  • enabled (bool) – Enable this entry to be scheduled.

  • task (str) – The full python path to the task to run.

  • args (Optional[Tuple[Any, ...]]) – Positional arguments to pass the task. These will be serialized/deserialized as JSON. jsonpickle is used to serialize and deserialize these.

  • kwargs (Optional[Dict[str, Any]]) – Keyword arguments to pass the task. These will be serialized/deserialized as JSON. jsonpickle is used to serialize and deserialize these.

  • due_at (datetime.datetime) – The due at datetime. Takes naive or aware datetimes. Naive datetimes are assumed to be in UTC.

_logger

Logger.

Type:

ClassVar

client_read_only_fields

Client read only list of fields. Enumerates the fields that are not normally saved when a client wants to save the entry. This is done because the client manages these fields. So they are are updated when the scheduler runs them.

Type:

ClassVar[List[str]], optional

__iter__() TupleGenerator

so dict(model) works

__pretty__(fmt: Callable[[Any], Any], **kwargs: Any) Generator[Any, None, None]

Used by devtools (https://python-devtools.helpmanual.io/) to provide a human readable representations of objects

__repr_name__() str

Name of the instance’s class, used in __repr__.

__rich_repr__() RichReprResult

Get fields for Rich library

classmethod __try_update_forward_refs__(**localns: Any) None

Same as update_forward_refs but will not raise exception when forward references are not defined.

classmethod construct(_fields_set: SetStr | None = None, **values: Any) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters:
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns:

new model instance

dict(*args, **kwargs) dict

Override of the pydantic dict method.

Adds the __beatdrop_type__ field for the SchedulerEntry Class name.

Returns:

Dictionary representation of the model.

Return type:

dict

due_in() timedelta

Returns when the schedule entry should run next.

Returns:

Time left until this entry should be scheduled. Zero or negative timedeltas mean it should be run.

Return type:

datetime.timedelta

Raises:

beatdrop.exceptions.MethodNotImplementedError – Must implement this method in subclass.

json(*args, **kwargs) str

Override of the pydantic json method.

Adds the __beatdrop_type__ field for the SchedulerEntry Class name.

Returns:

JSON representation of the model.

Return type:

str

sent()

Called when the entry has been sent for execution.

This should be used to update any metadata as necessary for the entry. Like the last sent time etc.

Raises:

beatdrop.exceptions.MethodNotImplementedError – Must implement this method in subclass.

classmethod update_forward_refs(**localns: Any) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.