Skip to content

Commit

Permalink
add process time
Browse files Browse the repository at this point in the history
  • Loading branch information
StardustDL committed Feb 5, 2024
1 parent a364521 commit 3bdc9a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index/processor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextlib import contextmanager
import datetime
from functools import cached_property
import json
from pathlib import Path
Expand All @@ -20,6 +21,7 @@ class ProcessState(IntEnum):
class ProcessResult(BaseModel):
version: str
state: ProcessState
time: datetime.datetime


class ProcessDB(BaseModel):
Expand All @@ -40,7 +42,7 @@ def do(self, job: str, version: str):
raise

def done(self, job: str, version: str, state: ProcessState):
self.data[job] = ProcessResult(version=version, state=state)
self.data[job] = ProcessResult(version=version, state=state, time=datetime.datetime.now())

def save(self):
self.path.write_text(self.model_dump_json())
Expand Down
3 changes: 2 additions & 1 deletion index/std.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ def removeMain(path: Path):
for item in path.glob("**/__main__.py"):
if not item.is_file():
continue
if "pip" in path.parts:
if "pip" in item.parts:
continue
toRemove.append(item)
env.logger.info(f"Remove __main__.py: {toRemove}")
for item in toRemove:
os.remove(item)

Expand Down

0 comments on commit 3bdc9a7

Please sign in to comment.