-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCB: better logging for demo collection #28
PCB: better logging for demo collection #28
Conversation
with open(file_name, "wb") as f: | ||
pkl.dump(transitions, f) | ||
print(f"saved {success_needed} demos to {file_name}") | ||
file_name = f"./pcb_insert_{success_needed}_demos_{uuid}.pkl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it easier if we check the dir exists beforehand? else create the dir if it doesnt exist. something like
if os.path.exists(DATA_DIRECTORY):
shutil.rmtree(DATA_DIRECTORY)
os.makedirs(DATA_DIRECTORY)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. We need to check if the dir exists, and whether we have write permission to that dir. We can start recording only after this check completes. Is that a preferable solution?
Also, I don't think we should do an shutil.rmtree
on any users machine. The user might be storing demo files in the same directory as other code or files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just create the dir is suffice and maybe check the write permission too.
ahh yes, you are right, we shouldnt do rmtree
, I copied this code snippet from another codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes
No description provided.