(cls, model, mask_secrets=False)
| 151 | |
| 152 | @classmethod |
| 153 | def from_model(cls, model, mask_secrets=False): |
| 154 | doc = cls._from_model(model, mask_secrets=mask_secrets) |
| 155 | |
| 156 | doc["result"] = ActionExecutionDB.result.parse_field_value(doc["result"]) |
| 157 | |
| 158 | start_timestamp = model.start_timestamp |
| 159 | start_timestamp_iso = isotime.format(start_timestamp, offset=False) |
| 160 | doc["start_timestamp"] = start_timestamp_iso |
| 161 | |
| 162 | end_timestamp = model.end_timestamp |
| 163 | if end_timestamp: |
| 164 | end_timestamp_iso = isotime.format(end_timestamp, offset=False) |
| 165 | doc["end_timestamp"] = end_timestamp_iso |
| 166 | doc["elapsed_seconds"] = (end_timestamp - start_timestamp).total_seconds() |
| 167 | |
| 168 | for entry in doc.get("log", []): |
| 169 | entry["timestamp"] = isotime.format(entry["timestamp"], offset=False) |
| 170 | |
| 171 | attrs = {attr: value for attr, value in six.iteritems(doc) if value} |
| 172 | return cls(**attrs) |
| 173 | |
| 174 | @classmethod |
| 175 | def to_model(cls, instance): |
nothing calls this directly
no test coverage detected