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

type piracy of Base.schedule(t::Task) #32

Closed
rfourquet opened this issue Feb 1, 2022 · 5 comments · Fixed by #96
Closed

type piracy of Base.schedule(t::Task) #32

rfourquet opened this issue Feb 1, 2022 · 5 comments · Fixed by #96
Labels
enhancement New feature or request

Comments

@rfourquet
Copy link

It makes me a bit nervous, and also prevents packages depending on OpenTelemetryAPI to have proper precompilation, getting the following warning if I don't put `precompile(false):

   ** incremental compilation may be fatally broken for this module **

Is there any plan on not relying on type piracy?

@findmyway
Copy link
Member

I'd like to, but can't find an alternative to automatically pass Context info into nested tasks at the time. One possible solution is to create a dedicated field in the Task object, or at least allow executing some hooks when scheduling each task. (I guess this is worth creating an issue in Julia?)


Some more words on type piracy here:

In OpenTelemetry, it mentioned the cross cutting concern. This means that we may have to use type piracy for many instrumentation implementations. Otherwise, we need to modify the upstream packages directly to allow injecting customized logic, JuliaWeb/HTTP.jl#608 for example.

@findmyway findmyway added the enhancement New feature or request label Feb 7, 2022
@findmyway
Copy link
Member

findmyway commented Feb 8, 2022

It seems a related issue is already opened: JuliaLang/julia#35757

Especially this comment: JuliaLang/julia#35757 (comment)

@raffopazzo
Copy link

I haven't taken a deep look at the code yet but would it be possible to at least move the type piracy outside of the API module? In my project I embed Julia in a C++ app and I implement a meter provider that passes measurements to the C++ layer so in cases like this there is no need for that code to be in the API module itself. Should the override be in SDK instead?

@findmyway
Copy link
Member

I haven't taken a deep look at the code yet but would it be possible to at least move the type piracy outside of the API module? ... Should the override be in SDK instead?

Thanks! That's a good suggestion. I think it is doable. I'll give it a try and do some tests.

@pankgeorg
Copy link

@lamdor brought up https://github.com/vchuravy/ScopedValues.jl (and the respective JuliaLang/julia#50958 PR). These are inherited across tasks, so they could potentially serve this purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants