Skip to content

Conversation

@paaragon
Copy link
Contributor

@paaragon paaragon commented Dec 2, 2025

Summary

This PR refactors the storages arguments so instead of receiving title and provider, they receive a function instance.

Details and comments

@paaragon paaragon requested a review from a team as a code owner December 2, 2025 16:12
@paaragon paaragon requested a review from Tansito December 2, 2025 16:14
@paaragon paaragon marked this pull request as draft December 2, 2025 16:16
@paaragon paaragon marked this pull request as ready for review December 3, 2025 10:24
@paaragon paaragon requested a review from ElePT December 3, 2025 10:25
@paaragon paaragon self-assigned this Dec 3, 2025
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Same comment as I left on another PR: As a side note, I think that it would be good to also start documenting more internal-facing changes in the release notes, as we started doing with interface changes. I left some pointers in another PR on how to do this: #1788 (comment). If you don't agree, I am open for discussion on what should and shouldn't be part of the renos.

@paaragon
Copy link
Contributor Author

paaragon commented Dec 3, 2025

Same comment as I left on another PR: As a side note, I think that it would be good to also start documenting more internal-facing changes in the release notes, as we started doing with interface changes. I left some pointers in another PR on how to do this: #1788 (comment). If you don't agree, I am open for discussion on what should and shouldn't be part of the renos.

Thanks @ElePT . Change is done

@paaragon paaragon requested a review from ElePT December 3, 2025 10:59
Copy link
Contributor

@korgan00 korgan00 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just a minor thing.

Comment on lines 39 to 41
Attributes:
username (str): storage user's username
working_dir (WorkingDir(Enum)): working directory
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that you can safely remove this too.

Args:
function: Program model instance containing title, provider, and author
"""
username = function.author.username
Copy link
Member

Choose a reason for hiding this comment

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

Correct if I'm wrong but this is not correct. The username comes from the request, not from the author from the function, right?

Copy link
Member

Choose a reason for hiding this comment

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

Different users can use the same function and artifacts need to be stored in the path that the user is using it. The issue was only proposing to change function title and provider. User will need to continue being required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I didn't take that in mind. Can you add a test before fix this to catch this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right! I have changed it

Args:
function: Program model instance containing title, provider, and author
"""
username = function.author.username
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I didn't take that in mind. Can you add a test before fix this to catch this case?

@paaragon paaragon requested review from Tansito and korgan00 December 4, 2025 11:33
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

The release note looks very good, thanks @paaragon. I have not had time to go through the rest of the PR, but I see that you already have a good amount of reviews.

Copy link
Contributor

@korgan00 korgan00 left a comment

Choose a reason for hiding this comment

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

Could you add a test trying to access Arguments storage with multiple users and have different contents in the files? The function creator with some arguments, one user with other arguments and a third one without a file. The three using the same function.
I think it should test #1789 (comment).

Comment on lines +18 to 28
def __init__(self, function):
"""
Initialize the storage path for a given function.
Args:
function: Program model instance containing author
"""
username = function.author.username
self.user_results_directory = os.path.join(
settings.MEDIA_ROOT, username, "results"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this changes is putting the result data in the wrong folder. The folder should be the user who runs the job. That means, this change is not needed at all.

self.assertEqual(job.config.max_workers, 5)
self.assertEqual(job.config.workers, None)
self.assertEqual(job.config.auto_scaling, True)

Copy link
Contributor

Choose a reason for hiding this comment

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

We should assert if the folder name where the result/argument/logs/whatever is created is right, not only the content.

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.

5 participants