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

Job outputfiles cannot be extended #2190

Open
mesmith75 opened this issue Aug 16, 2023 · 7 comments
Open

Job outputfiles cannot be extended #2190

mesmith75 opened this issue Aug 16, 2023 · 7 comments

Comments

@mesmith75
Copy link
Contributor

mesmith75 commented Aug 16, 2023

It seems that one cannot add files to an existing list of outputfiles, only define a completely new list. This does not seem right to me:

Ganga In [6]: type(jobs(997).outputfiles)
Ganga Out [6]: GangaCore.GPIDev.Base.Proxy.GangaList

[21:02:04]
Ganga In [7]: jobs(997).outputfiles = []

[21:02:10]
Ganga In [8]: jobs(997).outputfiles
Ganga Out [8]: []

[21:02:12]
Ganga In [9]: jobs(997).outputfiles.append(LocalFile('model.root'))

[21:02:17]
Ganga In [10]: jobs(997).outputfiles
Ganga Out [10]: []
@mesmith75 mesmith75 changed the title GangaList not working Job outputfiles cannot be extended Aug 16, 2023
@mesmith75
Copy link
Contributor Author

mesmith75 commented Aug 16, 2023

This works fine for inputfiles - so somewhere we are treating outputfiles as special. It could be around here: https://github.com/ganga-devs/ganga/blob/da620e6914e59de3dd76adcb0c53ea03a7411ffc/ganga/GangaCore/GPIDev/Lib/Job/Job.py#L583C1-L583C1
If I change that to return self.outputfiles then the new files are appended as expected. However I assume there is a reason this extra complication is there?

@egede
Copy link
Member

egede commented Aug 21, 2023

To fix this will require to change the way that the GangaList object works. It should instead be inside the GangaList object that the expansion of the wildcards. But the GangaList is used for things that are not files, so how should this be solved?

@egede
Copy link
Member

egede commented Aug 21, 2023

This will require a bit more research into what current behaviour is, and how we want to change it.

@KisuZoid
Copy link

hey @egede @mesmith75

This will require a bit more research into what current behaviour is, and how we want to change it.

is there any conclusion regarding the functionality of the "GangaList".

@egede
Copy link
Member

egede commented Mar 19, 2025

Looking at this again, I think the critical point is that we for outputfiles return a new object rather than a reference to the old object. That means that when you append, you just append to this copy and the result is ignored. So the code will have to be rewritten to avoid that we make this copy. Feel free to give it a go.

@KisuZoid
Copy link

@egede, Thanks. I will try to rectify that issue and update as soon as possible.

Proposed solution: The issue is that the outputfiles property returns a copy of the list, so in-place modifications (like append) are lost. We should change it to return the actual list (or provide proper mutator methods). I'll work on a fix.

@egede
Copy link
Member

egede commented Mar 20, 2025

Make sure to run the tests in GangaCore/test/Unit and GangaCore/test/GPI locally when you have made changes. The CI testing shows clearly how you can run the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants