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

plex_run adds "python" annotation by default #600

Conversation

acashmoney
Copy link
Contributor

@acashmoney acashmoney commented Aug 15, 2023

The plex_run command now automatically includes a "python" annotation by default. This is to distinguish between using plex in Python and Go for analytics purposes.

To Test:

cd python/dev
pip install -e ../
python example.py

To Do Before Merging:
[ ] Upgrade pip pkg version number in python/setup.py
[ ] Publish new pip pkg version

@linear
Copy link

linear bot commented Aug 15, 2023

LAB-512 default add 'python' annotation for bacalhau submissions made through pip pkg

This enables better insights into how many users interact through our notebooks.

@vercel
Copy link

vercel bot commented Aug 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ❌ Failed (Inspect) Aug 17, 2023 9:58pm

@acashmoney acashmoney temporarily deployed to ci August 15, 2023 05:55 — with GitHub Actions Inactive
@acashmoney
Copy link
Contributor Author

acashmoney commented Aug 15, 2023

@hevans66 does this change anything related to how we make our metabase queries?

python/src/plex/__init__.py Outdated Show resolved Hide resolved
python/dev/example.py Outdated Show resolved Hide resolved
cmd.append(f"--annotations={annotations.join(',')}")
# Ensure "python" is always in the annotations list
if "python" not in annotations:
annotations.append("python")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its arguable whether your intended effect is to mutate whatever list was passed in. Since I feel like this "python" is an internal annotation I would change this to annotations = annotations + ["python"]. That way we don't mutate the list of annotations a user gave us. This a very nitpick thing though, feel free to leave this.

if "python" not in annotations:
annotations.append("python")

cmd.append(f"--annotations={','.join(annotations)}")
Copy link
Collaborator

@hevans66 hevans66 Aug 15, 2023

Choose a reason for hiding this comment

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

Staring at this more closely. I don't think it woks. Its causing one big string with commas in it, instead of a list of strings.

I believe there is nothing in the cobra go package that would separate these out into individual strings from the annotations comma separated list. Instead we need to pass the same flag multiple times to have it interpret it as an array.

I think this needs to look something like

cmd.extend([f"-a={annotation}" for annotation in annotations])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging @hevans66. This change should fix it so we get a new string for each annotation. Each string makes up an individual element in the golang array.

# Add each annotation as a separate parameter to cmd
for annotation in annotations:
cmd.append(f"--annotations={annotation}")

Screenshot_2023-08-17_at_2 31 15_PM

Copy link
Collaborator

@hevans66 hevans66 left a comment

Choose a reason for hiding this comment

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

🚢 🇮🇹

@acashmoney
Copy link
Contributor Author

Vercel check can be ignored

@acashmoney acashmoney merged commit 0cc3ead into main Aug 17, 2023
2 of 3 checks passed
@acashmoney acashmoney deleted the 593-lab-512-default-add-python-annotation-for-bacalhau-submissions-made-through-pip-pkg branch August 17, 2023 22:03
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.

[LAB-512] default add 'python' annotation for bacalhau submissions made through pip pkg
2 participants