-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rachel Chen
authored and
Rachel Chen
committed
Sep 16, 2024
1 parent
935a29c
commit 0d1f3b7
Showing
6 changed files
with
78 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
import os | ||
from typing import Any, Sequence | ||
import typing | ||
from typing import Sequence | ||
|
||
import simplejson | ||
|
||
from snuba.manual_jobs import JobSpec | ||
|
||
|
||
class ManifestReader: | ||
@staticmethod | ||
def read(filename: str) -> Sequence[Any]: | ||
def read(filename: str) -> Sequence[JobSpec]: | ||
local_root = os.path.dirname(__file__) | ||
with open(os.path.join(local_root, filename)) as stream: | ||
contents = simplejson.loads(stream.read()) | ||
assert isinstance(contents, Sequence) | ||
return contents | ||
contents_dict = dict(zip(contents[::2], contents[1::2])) | ||
job_specs = [] | ||
for content in contents: | ||
assert isinstance(content, dict) | ||
job_spec = JobSpec( | ||
job_id=typing.cast(str, contents_dict.get("id")), | ||
job_type=typing.cast(str, contents_dict.get("job_type")), | ||
params=contents_dict.get("params"), | ||
) | ||
job_specs.append(job_spec) | ||
return job_specs | ||
|
||
|
||
def read_jobs_manifest() -> Sequence[Any]: | ||
def read_jobs_manifest() -> Sequence[JobSpec]: | ||
return ManifestReader.read("run_manifest.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters