@@ -68,16 +68,16 @@ def __post_init__(self) -> None: |
68 | 68 | if self.kwargs is None: |
69 | 69 | self.kwargs = {} |
70 | 70 |
|
71 | | - def _compare(self, job: object) -> int: |
| 71 | + def _compare(self, job: Job) -> int: |
72 | 72 | """compares two jobs by priority or index. |
73 | 73 |
|
74 | 74 | Arguments: |
75 | | - job {ppqueue.Job} |
| 75 | + job: ... |
76 | 76 |
|
77 | 77 | Returns: |
78 | | - int -- `1` if `self` is greater than comparison, |
79 | | - `-1` if `self` is less than, |
80 | | - `0` if equal. |
| 78 | + `1` if `self` is greater than comparison, |
| 79 | + `-1` if `self` is less than, |
| 80 | + `0` if equal. |
81 | 81 | """ |
82 | 82 | return compare_by(self, job, by=["priority", "idx"]) |
83 | 83 |
|
@@ -117,7 +117,11 @@ def join(self, *args, **kwargs) -> None: |
117 | 117 | self.inner_job.join(*args, **kwargs) |
118 | 118 |
|
119 | 119 | def get_exit_code(self) -> int | None: |
120 | | - """Exit code of the job.""" |
| 120 | + """Exit code of the job. |
| 121 | +
|
| 122 | + Returns: |
| 123 | + ... |
| 124 | + """ |
121 | 125 | if ( |
122 | 126 | not self.inner_job |
123 | 127 | or not hasattr(self.inner_job, "exitcode") |
@@ -146,6 +150,9 @@ def stop(self) -> None: |
146 | 150 | def get_seconds_running(self) -> float | None: |
147 | 151 | """The number of seconds a job was running for. |
148 | 152 |
|
| 153 | + Returns: |
| 154 | + ... |
| 155 | +
|
149 | 156 | Examples: |
150 | 157 | >>> from ppqueue import Queue |
151 | 158 | >>> from time import sleep |
@@ -164,6 +171,9 @@ def get_seconds_running(self) -> float | None: |
164 | 171 | def get_seconds_waiting(self) -> float | None: |
165 | 172 | """The amount of time a data has spent in the waiting queue. |
166 | 173 |
|
| 174 | + Returns: |
| 175 | + ... |
| 176 | +
|
167 | 177 | Examples: |
168 | 178 | >>> job.get_seconds_waiting() # doctest: +SKIP |
169 | 179 | """ |
@@ -178,6 +188,9 @@ def get_seconds_waiting(self) -> float | None: |
178 | 188 | def get_seconds_total(self) -> float | None: |
179 | 189 | """Returns the waiting + running duration of this job. |
180 | 190 |
|
| 191 | + Returns: |
| 192 | + ... |
| 193 | +
|
181 | 194 | Examples: |
182 | 195 | >>> job.get_seconds_total() # doctest: +SKIP |
183 | 196 | """ |
@@ -192,6 +205,9 @@ def get_seconds_total(self) -> float | None: |
192 | 205 | def get_submit_timestamp(self) -> datetime | None: |
193 | 206 | """The time this job was submitted. |
194 | 207 |
|
| 208 | + Returns: |
| 209 | + ... |
| 210 | +
|
195 | 211 | Examples: |
196 | 212 | >>> job.get_submit_timestamp() # doctest: +SKIP |
197 | 213 | """ |
@@ -200,19 +216,31 @@ def get_submit_timestamp(self) -> datetime | None: |
200 | 216 | return None |
201 | 217 |
|
202 | 218 | def get_start_timestamp(self) -> datetime | None: |
203 | | - """Returns a datetime object of the time this data was started.""" |
| 219 | + """Returns a datetime object of the time this data was started. |
| 220 | +
|
| 221 | + Returns: |
| 222 | + ... |
| 223 | + """ |
204 | 224 | if self.start_timestamp: |
205 | 225 | return datetime.utcfromtimestamp(self.start_timestamp) |
206 | 226 | return None |
207 | 227 |
|
208 | 228 | def get_finish_timestamp(self) -> datetime | None: |
209 | | - """Returns a datetime object of the time this data finished.""" |
| 229 | + """Returns a datetime object of the time this data finished. |
| 230 | +
|
| 231 | + Returns: |
| 232 | + ... |
| 233 | + """ |
210 | 234 | if self.finish_timestamp: |
211 | 235 | return datetime.utcfromtimestamp(self.finish_timestamp) |
212 | 236 | return None |
213 | 237 |
|
214 | 238 | def get_processed_timestamp(self) -> datetime | None: |
215 | | - """Returns a datetime object of the time this data was processed.""" |
| 239 | + """Returns a datetime object of the time this data was processed. |
| 240 | +
|
| 241 | + Returns: |
| 242 | + ... |
| 243 | + """ |
216 | 244 | if self.process_timestamp: |
217 | 245 | return datetime.utcfromtimestamp(self.process_timestamp) |
218 | 246 | return None |
|