Good day,
We’ve created a Flask POST API within a Dockerfile, imported as an Artifact in Foundry, and then used the Artifact in a Compute Module. The Compute Module is running in pipeline mode, with no inputs or outputs.
The Dockerfile and API service runs fine on the localhost but once running in the Compute Module, its unclear what the IP address should be for posting a request to the API service from outside of Foundry. Usually, one would replace the 127.0.0.1 localhost IP address with the actual IP address of the host.
Is there an IP address that can be used once running in production in Foundry? Or does this problem need to be addressed from a different angle?
The below post seems to note that it might be possible but via functions (not pipeline)?
https://community.palantir.com/t/exploring-compute-modules/1577/3
PS. The main reason for creating a custom Flask API is due to the rigid format the Ontology APIs require when making a request (i.e. “params: …”). In our scenario, we need to be able to receive the request body as the source system is sending it. The source system cannot change the input format/structure of the payload.
Any assistance/guidance will be greatly appreciated!
I don’t believe this will work. Containers are ephemeral and won’t have a dedicated reusable IP.
What I think you want to do are define the flask endpoints via the function definitions in the docs and then those get exposed in the platform as functions for use.
Hi Ser,
Thanks for responding to the question.
My initial thought was that due to containers being ephemeral, its perfect for hosting an API that should never disconnect but if there’s no usable IP address it wont work.
Possible to point me towards the function definitions you are referring to? Or are you referring to the ‘function-backed compute module’?
Also, would your suggestion allow for systems outside of Foundry to make a POST request to the flask endpoint?
(Def take a Palantirian word for it over mine btw, but)
I think what you are getting at…
1) you can publish a compute module functions to Foundry
2) Include that fn() in your ontology
3) Use in SDK
And then in your 3rd party app you can authenticate and hit your base foundry urls:
https://..palantirfoundry.com/
I believe the nature of the Rubix foundry infra means dedicated IPs will never be dependable and you need to use the base urls and foundry/ontology native ingress tools…
DOCS on how to publish functions:
https://www.palantir.com/docs/foundry/compute-modules/functions/
Hi @SerKnight. Thanks for the detailed feedback.
Went through the steps to add the function under Resource Scopes. Unfortunately, the solution ended up taking me back to the original problem - needing to provide the input data within the “parameters: {…}” body structure (as the source system is automated and cannot adjust the input body structure)
Thanks again for you assistance. We are in touch with Palantir now. I will return to this post with a solution once figured out.
1 Like