Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

docs(samples): Adding first sample code + tests #22

Merged
merged 21 commits into from
Sep 15, 2022
Merged

Conversation

m-strzelczyk
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Aug 29, 2022
@snippet-bot
Copy link

snippet-bot bot commented Aug 29, 2022

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: batch Issues related to the googleapis/python-batch API. samples Issues that are directly related to samples. labels Aug 29, 2022
@m-strzelczyk m-strzelczyk requested a review from Shnatsel August 29, 2022 14:55
@m-strzelczyk m-strzelczyk marked this pull request as ready for review August 29, 2022 14:55
@m-strzelczyk m-strzelczyk requested a review from a team as a code owner August 29, 2022 14:55
@m-strzelczyk m-strzelczyk requested a review from nicain August 29, 2022 14:55
runnable.script.text = "echo Hello world! This is task ${BATCH_TASK_INDEX}. This job has a total of ${BATCH_TASK_COUNT} tasks."
# You can also run a script from a file. Just remember, that needs to be a script that's
# already on the VM that will be running the job.
# runnable.script.path = '/tmp/test.sh'

Choose a reason for hiding this comment

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

Can we use echo or something available out of the box so that running this would always do something visible and make the sample useful out of the box?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid that won't work for the runnable.script.path version. It has to be a path to a file, and the file needs to be present on the running machine. This is useful only when we'd use a custom machine image I think, that has some file where we need it.

Copy link

Choose a reason for hiding this comment

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

Does /usr/bin/echo not work? It should be there on nearly any Linux system.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think I understand. It does run echo Hello world! This is task ${BATCH_TASK_INDEX}. This job has a total of ${BATCH_TASK_COUNT} tasks..

The commented out part about script path is an alternate version, exclusive with running a script by providing it as a text.

Copy link

Choose a reason for hiding this comment

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

As a user, I'm still confused why this is even an option and how it differs from the regular invocation. If all it does is read the test and execute it in the default shell, I might as well write /bin/sh /tmp/test.sh. So why does this exist and under what circumstances may I want to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that it is redundant, however it was not my idea to create it that way :D I just want to present to the end user that it's an option, it's up to them if they want to use it or not.

@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 30, 2022
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 30, 2022
@parthea parthea assigned Shnatsel and unassigned m-strzelczyk Sep 6, 2022
@parthea parthea requested a review from Shnatsel September 6, 2022 16:34
Copy link

@Shnatsel Shnatsel left a comment

Choose a reason for hiding this comment

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

Mostly corrections to comments, and one unresolved item that we may need input from the product team on.

Tip for the future: copy your comments into Google Docs and let it nitpick your English.

runnable.script.text = "echo Hello world! This is task ${BATCH_TASK_INDEX}. This job has a total of ${BATCH_TASK_COUNT} tasks."
# You can also run a script from a file. Just remember, that needs to be a script that's
# already on the VM that will be running the job.
# runnable.script.path = '/tmp/test.sh'
Copy link

Choose a reason for hiding this comment

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

As a user, I'm still confused why this is even an option and how it differs from the regular invocation. If all it does is read the test and execute it in the default shell, I might as well write /bin/sh /tmp/test.sh. So why does this exist and under what circumstances may I want to use it?

@Shnatsel Shnatsel assigned m-strzelczyk and unassigned Shnatsel Sep 7, 2022
@Shnatsel
Copy link

Shnatsel commented Sep 7, 2022

I've requested clarification from the Batch PM on why text and path exist as separate entities. Waiting on their response.

@Shnatsel
Copy link

Shnatsel commented Sep 7, 2022

Actually, let's not block the merge on that. We can always handle that particular clarification later.

@Shnatsel Shnatsel assigned nicain and unassigned Shnatsel Sep 7, 2022
@parthea parthea requested a review from a team as a code owner September 13, 2022 18:18
@m-strzelczyk m-strzelczyk added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@yoshi-kokoro yoshi-kokoro removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Sep 14, 2022
@m-strzelczyk m-strzelczyk added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@m-strzelczyk m-strzelczyk added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@m-strzelczyk m-strzelczyk added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: batch Issues related to the googleapis/python-batch API. samples Issues that are directly related to samples. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants