Skip to content

Commit

Permalink
Merge pull request #178 from facebookresearch/short-service-id
Browse files Browse the repository at this point in the history
[rpc] Use a more terse name for service working directories.
  • Loading branch information
ChrisCummins authored Apr 9, 2021
2 parents db946bf + 722aab4 commit cfea429
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions compiler_gym/service/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,12 @@ def loglines(self) -> Iterable[str]:
yield from ()


def make_working_dir():
"""Make a working directory for a service. The calling code is responsible for
removing this directory when done.
def make_working_dir() -> Path:
"""Make a working directory for a service. The calling code is responsible
for removing this directory when done.
"""
timestamp = datetime.now().isoformat()
random_hash = random.getrandbits(16)
service_name = f"service-{timestamp}-{random_hash:04x}"
service_name = datetime.now().strftime(f"s/%m%dT%H%M%S-%f-{random_hash:04x}")
working_dir = transient_cache_path(service_name)
(working_dir / "logs").mkdir(parents=True, exist_ok=False)
return working_dir
Expand Down

0 comments on commit cfea429

Please sign in to comment.