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

refactor: Container launcher argument refactoring #2820

Closed
wants to merge 5 commits into from

Conversation

hpohekar
Copy link
Collaborator

@hpohekar hpohekar commented May 14, 2024

closes #2818

Updated self.<argument_name> to self.argvals['<argument_name>'].

@raph-luc
Copy link
Member

@hpohekar This approach is not only being used for the container launcher, that was just one example:

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

It is also being used in:

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

@hpohekar
Copy link
Collaborator Author

@hpohekar This approach is not only being used for the container launcher, that was just one example:

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

It is also being used in:

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

for arg_name, arg_values in argvals.items():
setattr(self, arg_name, arg_values)
self.argvals = argvals

@raph-luc I think use of self.<argument_name> is good for readability than self.argvals['argument_name'].

@raph-luc
Copy link
Member

@raph-luc I think use of self.<argument_name> is good for readability than self.argvals['argument_name'].

In my understanding, the issue isn't which one is more readable on its own, the issue is that we are using both interchangeably and that makes things unnecessarily complicated (have to keep track of both when debugging issues).

I'd say pick one (either self.<argument_name> or self.argvals['argument_name']) and stick with it. I believe that self.argvals['argument_name'] is the most flexible one so we should probably stick with that one.

@hpohekar
Copy link
Collaborator Author

hpohekar commented May 14, 2024

@raph-luc I think use of self.<argument_name> is good for readability than self.argvals['argument_name'].

In my understanding, the issue isn't which one is more readable on its own, the issue is that we are using both interchangeably and that makes things unnecessarily complicated (have to keep track of both when debugging issues).

I'd say pick one (either self.<argument_name> or self.argvals['argument_name']) and stick with it. I believe that self.argvals['argument_name'] is the most flexible one so we should probably stick with that one.

@raph-luc I think use of self.<argument_name> is good for readability than self.argvals['argument_name'].

In my understanding, the issue isn't which one is more readable on its own, the issue is that we are using both interchangeably and that makes things unnecessarily complicated (have to keep track of both when debugging issues).

I'd say pick one (either self.<argument_name> or self.argvals['argument_name']) and stick with it. I believe that self.argvals['argument_name'] is the most flexible one so we should probably stick with that one.

I'd say pick one (either self.<argument_name>orself.argvals['argument_name']) and stick with it.

Yes, therefore we had followed the existing pattern by using self.<argument_name>.

@raph-luc
Copy link
Member

Yes, therefore we had followed the existing pattern by using self.<argument_name>.

What do you mean? In the code excerpts that I quoted above (see #2820 (comment)) we have both self.<argument_name> and self.argvals['argument_name']

@hpohekar
Copy link
Collaborator Author

hpohekar commented May 14, 2024

Yes, therefore we had followed the existing pattern by using self.<argument_name>.

What do you mean? In the code excerpts that I quoted above (see #2820 (comment)) we have both self.<argument_name> and self.argvals['argument_name']

We don't have self.argvals['argument_name'] anywhere after settings attributes as follows -

 for arg_name, arg_values in argvals.items(): 
     setattr(self, arg_name, arg_values) 

@raph-luc
Copy link
Member

We don't have self.argvals['argument_name'] anywhere after settings attributes as follows -

 for arg_name, arg_values in argvals.items(): 
     setattr(self, arg_name, arg_values) 

If self.argvals['argument_name'] was not being used as you say, then why were we also setting


?

Do you see where I am going?

We do have self.argvals['argument_name'], because self.argvals is being used for _generate_launch_string(), _build_fluent_launch_args_string(), etc., and the dictionary items inside self.argvals are accessed there. Simultaneously, we had self.<argument_name> pointing to the same variables as self.argvals['argument_name'], therefore we were indeed using both simultaneously. Does this make sense?

@hpohekar
Copy link
Collaborator Author

hpohekar commented May 15, 2024

We don't have self.argvals['argument_name'] anywhere after settings attributes as follows -

 for arg_name, arg_values in argvals.items(): 
     setattr(self, arg_name, arg_values) 

If self.argvals['argument_name'] was not being used as you say, then why were we also setting

?
Do you see where I am going?

We do have self.argvals['argument_name'], because self.argvals is being used for _generate_launch_string(), _build_fluent_launch_args_string(), etc., and the dictionary items inside self.argvals are accessed there. Simultaneously, we had self.<argument_name> pointing to the same variables as self.argvals['argument_name'], therefore we were indeed using both simultaneously. Does this make sense?

If self.argvals['argument_name'] was not being used as you say, then why were we also setting self.argvals = argvals ?

We are using self.argvals in following lines right ?

kwargs = _get_subprocess_kwargs_for_fluent(self.env, self.argvals)

How can we use argvals in __call__(self) method without setting it as an attribute of self i.e self.argvals ?

@hpohekar
Copy link
Collaborator Author

We do have self.argvals['argument_name'], because self.argvals is being used for _generate_launch_string(), _build_fluent_launch_args_string(), etc., and the dictionary items inside self.argvals are accessed there. Simultaneously, we had self.<argument_name> pointing to the same variables as self.argvals['argument_name'], therefore we were indeed using both simultaneously. Does this make sense?

We do have self.argvals['argument_name'], because self.argvals is being used for _generate_launch_string(), _build_fluent_launch_args_string(), etc., and the dictionary items inside self.argvals are accessed there.

  • Right, that's the exact point, it is used as self.argvals['argument_name'] inside the _generate_launch_string(), _build_fluent_launch_args_string(), _get_subprocess_kwargs_for_fluent() not inside the __call__(self) method right ?

Simultaneously, we had self.<argument_name> pointing to the same variables as self.argvals['argument_name'], therefore we were indeed using both simultaneously. Does this make sense?

Do you mean we are setting self.argvals["fluent_debug"] = True therefore we are using self.<argument_name> and self.argvals['argument_name'] simultaneously inside __call__(self) ?

self.argvals["fluent_debug"] = True

@hpohekar hpohekar closed this May 15, 2024
@hpohekar hpohekar deleted the refactor/container_launcher_refactoring branch May 15, 2024 09:08
@hpohekar
Copy link
Collaborator Author

hpohekar commented May 15, 2024

Closed due to failing of branch name style check.

New PR - #2822

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.

arg vals data management
2 participants