https://pantsbuild.org/ logo
#general
Title
# general
w

wonderful-iron-54019

01/29/2020, 1:43 PM
hey folks wondering if you can help me out here, i have a BUILD file, that contains the following (databricks_job is a custom target) and im getting an ambiguous owner error
Copy code
FAILURE: Owners for Resources(BuildFileAddress(src/adobe_mta/BUILD, config)) are ambiguous.  Found DatabricksJob(BuildFileAddress(src/adobe_mta/BUILD, job)) and 1 others: [PythonLibrary(BuildFileAddress(src/adobe_mta/BUILD, lib))]
Any advice?
Making some progress here. The
DatabricksJob
extends
PythonLibrary
when it isn't really a lib. This was a design decision we made to force the building of the library that the job depends on before deploying it. We weren't really thrilled with that solution but it seemed to work for the time being. How would we configure a Target to build/publish its dependent libs when being triggered?
r

red-balloon-89377

01/29/2020, 2:31 PM
Interesting rabbit hole! From the code, it looks like the function that raises this raises:
Copy code
:raises: `AmbiguousOwnerError` if there is more than one viable exported owner target for a
             given transitive dependency.
Now, this would indicate that both
:lib
and
:job
are exported. I don’t see the code that makes
python_library
exported by default, but let’s assume it is for now. The code that raises that exception (https://github.com/blorente/pants/blob/998e4edbe31c64aeacac5142ad90433fce9a748b/src/python/pants/backend/python/tasks/setup_py.py#L187) iterates not only over the dependency chain, but also over the siblings to calculate potential owners (this function call https://github.com/blorente/pants/blob/master/src/python/pants/backend/python/tasks/setup_py.py#L243, which calls this method: https://github.com/blorente/pants/blob/998e4edbe31c64aeacac5142ad90433fce9a748b/src/python/pants/backend/python/tasks/setup_py.py#L73)
w

wonderful-iron-54019

01/29/2020, 2:32 PM
hmmmm good looking out, i'll dig into this source
thanks!
r

red-balloon-89377

01/29/2020, 2:33 PM
It’s mostly to keep track myself, but yeah, might give you some clues maybe
w

wonderful-iron-54019

01/29/2020, 2:34 PM
yeah been swimming in that file for a minute now
thanks again, I'll report back with any interesting findings
r

red-balloon-89377

01/29/2020, 2:34 PM
Cool! Hope you find what you need 🙂
w

wonderful-iron-54019

01/29/2020, 2:46 PM
so i was able to achieve the results i need by switching https://github.com/pantsbuild/pants/blob/12711f2dc295fdda526cf9fab17146b87154ed08/src/python/pants/backend/python/tasks/setup_py.py#L699 to use
self.context.targets()
when
self._recursive
was set
wonder if that's a change the maintainers might approve
r

red-balloon-89377

01/29/2020, 2:50 PM
It seems sane in this case, but I’m not the most qualified to think about all the ramifications, no too familiar with this part of the code. If you open a PR, I can add reviewers to it 🙂
w

wonderful-iron-54019

01/29/2020, 2:50 PM
thanks, will do
@red-balloon-89377 just added you: https://github.com/pantsbuild/pants/pull/9035 if you could tage relevant folks it would be appreciated
r

red-balloon-89377

01/29/2020, 3:24 PM
Added 🙂
f

fancy-motherboard-24956

01/29/2020, 4:28 PM
Borja added me as reviewer. I don’t mind the code change, but don’t feel confident that I would catch subtle pitfalls that it may introduce, so will let a greyer beard chime-in 😄
w

wonderful-iron-54019

01/29/2020, 4:36 PM
yeah im definitely making some assumptions here. FWIW changing it locally seemed to cause no issues, but haven't really run it through its paces. However, seems reasonable that if recursive mode was on, it would package all those things up anyway
Appreciate the once-over
h

happy-kitchen-89482

02/20/2020, 10:30 PM
I'm a little surprised at this error - it implies that
:lib
and
:job
are both candidates to be the owner of
:config
, but AFAIK an owner has to be exported (that is, has to have a
provides=
clause), and neither of those do in your example. Did you elide those out of the example? I assume you were running
./pants setup-py [target]
?
w

wonderful-iron-54019

02/20/2020, 11:09 PM
yes they were elided. the
:job
gets a summy setup-py as its not really a python library. The PR i have outstanding allows us to stop subclassing the job as a library and still trigger dependent libs' build and publish steps
4 Views