Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
severo committed Aug 22, 2024
1 parent b17e339 commit 815daa1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions libs/libcommon/src/libcommon/queue/dataset_blockages.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DatasetBlockageDocument(Document):
Args:
dataset (`str`): The dataset on which to apply the job.
blocked_at (`datetime`): The date the dataset has been blocked.
When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
"""

meta = {
Expand Down
7 changes: 5 additions & 2 deletions libs/libcommon/src/libcommon/queue/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,12 @@ class JobDocument(Document):
priority (`Priority`, *optional*): The priority of the job. Defaults to Priority.LOW.
status (`Status`, *optional*): The status of the job. Defaults to Status.WAITING.
difficulty (`int`): The difficulty of the job: 1=easy, 100=hard as a convention (strictly positive integer).
created_at (`datetime`): The creation date of the job.
started_at (`datetime`, *optional*): When the job has started.
created_at (`datetime`): The creation date of the job. When read, it's an offset-naive datetime.
Use pytz.UTC.localize() to make it timezone-aware.
started_at (`datetime`, *optional*): When the job has started. When read, it's an offset-naive datetime.
Use pytz.UTC.localize() to make it timezone-aware.
last_heartbeat (`datetime`, *optional*): Last time the running job got a heartbeat from the worker.
When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
"""

meta = {
Expand Down
8 changes: 6 additions & 2 deletions libs/libcommon/src/libcommon/queue/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ class Lock(Document):
ttl = IntField()
job_id = StringField() # deprecated

created_at = DateTimeField()
updated_at = DateTimeField()
created_at = (
DateTimeField()
) # When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
updated_at = (
DateTimeField()
) # When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.

objects = QuerySetManager["Lock"]()

Expand Down
4 changes: 3 additions & 1 deletion libs/libcommon/src/libcommon/queue/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class JobTotalMetricDocument(Document):
status (`str`): job status see libcommon.queue.jobs.Status
dataset_status (`str`): whether the dataset is blocked ("normal", "blocked")
total (`int`): total of jobs
created_at (`datetime`): when the metric has been created.
created_at (`datetime`): when the metric has been created. When read, it's an
offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
"""

id = ObjectIdField(db_field="_id", primary_key=True, default=ObjectId)
Expand Down Expand Up @@ -84,6 +85,7 @@ class WorkerSizeJobsCountDocument(Document):
worker_size (`WorkerSize`): worker size
jobs_count (`int`): jobs count
created_at (`datetime`): when the metric has been created.
When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
"""

id = ObjectIdField(db_field="_id", primary_key=True, default=ObjectId)
Expand Down
1 change: 1 addition & 0 deletions libs/libcommon/src/libcommon/queue/past_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PastJobDocument(Document):
dataset (`str`): The dataset on which to apply the job.
duration (`int`): The duration of the job, in seconds.
finished_at (`datetime`): The date the job has finished.
When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
"""

meta = {
Expand Down
1 change: 1 addition & 0 deletions libs/libcommon/src/libcommon/simple_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class CachedResponseDocument(Document):
content (`dict`): The content of the cached response. Can be an error or a valid content.
details (`dict`, *optional*): Additional details, eg. a detailed error that we don't want to send as a response.
updated_at (`datetime`): When the cache entry has been last updated.
When read, it's an offset-naive datetime. Use pytz.UTC.localize() to make it timezone-aware.
duration (`float`, *optional*): Duration of a corresponding job in seconds.
job_runner_version (`int`): The version of the job runner that cached the response.
failed_runs (`int`): The number of failed_runs to get cached result.
Expand Down

0 comments on commit 815daa1

Please sign in to comment.