-
Notifications
You must be signed in to change notification settings - Fork 651
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
[FSN-13] feat(nf-tower): Retrieve and set Fusion license tokens in a process environment #5614
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
modules/nextflow/src/main/groovy/nextflow/fusion/FusionClient.groovy
Outdated
Show resolved
Hide resolved
bee1e99
to
6fc8fbe
Compare
@pditommaso I have refactored the implementation into
|
I agree, sorry if I may have suggested in that direction. My point was to move this logic in the tower client module
don't worry about that, use the java provider client for example nextflow/plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerXAuth.groovy Lines 56 to 62 in 6183fdf
|
Signed-off-by: Alberto Miranda <[email protected]>
6fc8fbe
to
e7b1082
Compare
FusionClient
to send fusion-related HTTP requests to Platform
@pditommaso I refactored the implementation based on our discussions. The PR is ready to review. |
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some comments. Question, what happens when using Fusion and Tower plugin is not enabled?
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
Nothing special, if |
Will Fusion be able to run? |
The license is not yet enforced in the Fusion side, so yes. A side effect we didn't consider is that if EDIT: Even if not enforced by nextflow, fusion will still fail once licenses become mandatory, but the error received by the user will probably be uglier. |
…per` Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
and slower, ie. after the job started. we should consider adding a "default" The "default" See here for example nextflow/plugins/nf-wave/src/main/io/seqera/wave/plugin/resolver/WaveContainerResolver.groovy Line 41 in 9eefd20
|
It's a great idea, but if I understand correctly the mechanism you propose, it prioritizes between implementations of a specific interface doesn't it? For our case, we need to override one implementer of |
You are right, it may need some customisation in the plugins handling. Ignore it for now. |
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, left a few comments but nothing blocking
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
() -> { | ||
log.debug "Request: method:=${req.method()}; uri:=${req.uri()}; request:=${req}" | ||
final resp = httpClient.send(req, HttpResponse.BodyHandlers.ofString()) | ||
log.debug "Response: statusCode:=${resp.statusCode()}; body:=${resp.body()}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This response is going to contain an authentication token right? Do we want to log it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I'm not sure about what the preferred policy is in Nextflow logs (cc @pditommaso)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the token temporary, right? then it should not be a problem
plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerFusionEnv.groovy
Outdated
Show resolved
Hide resolved
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
Signed-off-by: Alberto Miranda <[email protected]>
As discussed this morning, I have added caching of license token responses with a9849f5 and re-scoped the license-related error messages as Having said that, I'm not at all convinced that the caching is working as it should, so I would appreciate more experienced eyes looking into it. |
|
Signed-off-by: Alberto Miranda <[email protected]>
Does this depends on Fusion 2.5? |
No, it's also supported on Fusion 2.4 |
…tform-and-pass-it-to-fusion-using-envvar
Signed-off-by: Paolo Di Tommaso <[email protected]>
Description
This PR adds a new
TowerFusionEnv
class tonf-tower
that enables setting Platform-specific environment variables to Nextflow processes running with Fusion enabled. The class implements theFusionEnv
interface and, as such, provides agetEnvironment()
method that returns the relevant key-value pairs.Currently, the provider is only being used to set the
FUSION_LICENSE_TOKEN
environment variable, the value of which is retrieved by sending a specific HTTP request to Platform in order to validate the run. Once the run is validated, Platform will reply with a corresponding token which will be injected into the process environment.Note
Since fusion licenses are still not mandatory, if the license cannot be validated (or there's a configuration error affecting this validation process) a warning is emitted:
Testing
This PR can be tested by following this guide.