Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed May 23, 2024
1 parent 966755c commit 613a57b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,14 @@ def resolve_user(self, _graphene_info: ResolveInfo) -> Optional[str]:
return self._backfill_job.user

def resolve_logEvents(self, graphene_info: ResolveInfo, cursor: Optional[str] = None):
# very unsure how the cursor gets passed through, especially if called from get_backfills which also has a cursor
from ..schema.instigation import (
GrapheneInstigationEvent,
GrapheneInstigationEventConnection,
)
from ..schema.logs.log_level import GrapheneLogLevel

backfill_id = self._backfill_job.backfill_id
# TODO find a better way to keep this in sync. maybe store as part of the asset backfill data?
# TODO find a better way to keep the log key prefix in sync. maybe store as part of the asset backfill data?
backfill_log_key_prefix = ["backfill", backfill_id]

instance = graphene_info.context.instance
Expand All @@ -549,7 +548,7 @@ def resolve_logEvents(self, graphene_info: ResolveInfo, cursor: Optional[str] =
return GrapheneInstigationEventConnection(events=[], cursor="", hasMore=False)

if not instance.backfill_log_storage_enabled():
# myabe need to return something else to indicate that a setting needs to be changed
# maybe need to return something else to indicate that a setting needs to be changed
return GrapheneInstigationEventConnection(events=[], cursor="", hasMore=False)

log_keys = sorted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ def open_log_stream(
def is_capture_complete(self, log_key: Sequence[str]) -> bool:
return os.path.exists(self.complete_artifact_path(log_key))

def get_log_files_in_directory(self, log_key_dir: Sequence[str]) -> Sequence[str]:
base_dir_path = Path(self._base_dir).resolve()
log_dir = base_dir_path.joinpath(*log_key_dir).resolve()

return [
filename.rsplit(".", 1)[0] # TODO - need to remove the file extension. feels hacky
for filename in os.listdir(log_dir)
if os.path.isfile(os.path.join(log_dir, filename))
]

def get_log_data(
self, log_key: Sequence[str], cursor: Optional[str] = None, max_bytes: Optional[int] = None
) -> CapturedLogData:
Expand Down

0 comments on commit 613a57b

Please sign in to comment.