Skip to content
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

default_discovery_dir should use YT username #22

Conversation

faucct
Copy link
Collaborator

@faucct faucct commented Sep 17, 2024

#20

def default_user():
return os.getenv("YT_USER") or getpass.getuser()
def default_user(client=None):
return os.getenv("YT_USER") or (get_user_name(client=client) if client else None) or getpass.getuser()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a standard convention in almost all yt wrapper functions that they accept client as a last keyword argument, and client may be None, which means that the "default" client should be taken. In other words, I would expect that the "if client else None" part is not necessary;

Moreover, I would remove getpass.getuser() fallback, because there is no way that it can be useful. If the YT client is not configured, nothing would work at all, so get_user_name must succeed, and getuser is redundant.

return os.getenv("SPARK_YT_DISCOVERY_DIR") or YPath("//home").join(os.getenv("USER")).join("spark-tmp")
def default_discovery_dir(client=None):
return os.getenv("SPARK_YT_DISCOVERY_DIR") \
or YPath("//home").join(default_user(client=client)).join("spark-tmp")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to //tmp? None of the known YT clusters allows having top-level home user dirs.

Copy link

robot-magpie bot commented Sep 17, 2024

@zlobober has triggered the import of a pull request, but it hasn't started. If you are a Yandex employee, you can view the log.

@@ -218,8 +218,8 @@ def scala_buffer_to_list(buffer):
return [buffer.apply(i) for i in range(buffer.length())]


def default_user():
return os.getenv("YT_USER") or getpass.getuser()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import getpass on the line 2 is no longer needed, so it also should be removed

Copy link

robot-magpie bot commented Sep 23, 2024

@alextokarew has imported your pull request. If you are a Yandex employee, you can view this diff.

Copy link

robot-magpie bot commented Sep 23, 2024

✅ This pull request is being closed because it has been successfully merged into our internal monorepository.
Your changes will be pushed to this repository soon. Thank you for your contribution!

@robot-magpie robot-magpie bot closed this Sep 23, 2024
robot-piglet pushed a commit that referenced this pull request Sep 23, 2024
#20

---

Pull Request resolved: #22
commit_hash:dc2b9acb71855a0871e6b7b3d4f7899748f3d89f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants