-
Notifications
You must be signed in to change notification settings - Fork 11
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
Orchestration interfaces #233
Conversation
We added some implementation code to this PR during a mob session yesterday, but for the sake of the discussion here, let's keep focus on the contents of |
In order to not pollute this PR, I've made a separate branch where fmu-proxy makes use of this. PR: #239 |
Btw, I have implemented the uri-resolver for fmu-proxy now. Supports urls, files and pre-loaded guids. |
I like this PR. But, somehow we must be able to support SSP sources that is just a relative path (to comply with the standard this is actually the ONLY uri that have to be supported. Everything else is optional) So in the SSP, we should be able to specify as the source:
Right? |
Absolutely. See my comment regarding URI resolution above. This is exactly what I mean. It's just like how the base URI for an HTML file is its own URL, and inside it you can use both relative paths and absolute URLs for links, images, etc. |
We have no need for model_directory and slave_uri_resolver at the moment. It is better to re-introduce them at a later time if needed.
For FMU-proxy to support relative file paths, the source uri must be modified with the baseUri. e.g. To support this I changed std::string _uri;
auto npos = std::string_view::npos;
if ((uri.find(':') == npos) || uri[0] == '.')
{
_uri = std::string(baseUri) + "/" + std::string(uri);
} else if (uri.find("fmu-proxy") != npos && uri.find("?file=") != npos) {
_uri = std::string(uri).insert(uri.find("=")+1, std::string(baseUri.substr(8)) + "/");
} else {
_uri = std::string(uri);
} However, this inject knowledge about fmu-proxy into cse-core.. So any thoughts? |
In the update to this PR that I will push soon, I have replaced the poor-man's URI handling that you see here (which is completely wrong) with RFC 3986 compliant URI handling code. Part of that is a relative-to-base resolution function like the However, there is no standards-compliant way to do what you want here. The algorithm for resolving a URI reference relative to a base URI is given by the RFC, and it doesn't work like this. A way to support what you want to do would be to push the relative reference resolution all the way down to the How does that sound? |
Sounds good to me! |
Sorry for the spam. I've found out that the query returned from |
With |
Yes. The I'll add a function to convert a |
I guess :P Btw, should I add a url resolver to this PR? I can re-use the logic used by fmi4cpp . However, this will add a dependency to cURL. Do we want that? |
What would it do? For http addresses, you mean? At any rate, I think this PR is probably too big already. So let's make a new issue/PR to discuss that. |
It's alive! Man, it's annoying when Windows decides to do things differently from all other OSes, so you have to switch back and forth between them when developing. :-/ |
Yes. But we can make a future issue on it as you say. |
|
The URI standard doesn't treat filesystem paths as a special case, so your example Does SSP specifically allow the use of plain (non-URI) absolute paths on Windows? |
Then I was wrong about the slashes. I just noticed in code that there was some special handling of these and thought it would map to something like the above.
|
In which case? All the tests pass for this PR now, including the SSP parser tests. That said, I just realised that I forgot to change the base URI for SSP like we agreed. I'll be AFK for the remainder of this week, so if anyone else wants to take a stab at it, feel free. It is only a matter of a change in |
Damn, sorry. I must have pasted to wrong directory path into the Perhaps we should print the path of the FMU we are trying to import when it fails? |
It looks to me like the SSP standard specifically requires URIs, and I don't think we should violate that. |
You are absolutely right. |
8dc2f34
to
5b62ec8
Compare
I made the change, but then I undid it again. On closer inspection, it turns out that the SSP standard actually specifies that the base URI for an SSD is the URI of the SSD file itself (as opposed to its containing directory). I suppose this may be to allow distribution of standalone SSD files. |
f0763b5
to
20e24d6
Compare
I started looking into issue #165 and tried to think of how it can be put into a larger orchestration context, and here are some ideas that I'd like to discuss.
Here, I take "orchestration" to include one or more of the following tasks:
Premises:
What I propose here is therefore not to make the actual distributed orchestration system, but rather to try to define some interfaces and utility classes that are simple enough, and general enough, that they can support any orchestration system we can think of. We can supply some generally useful implementations, to support things like local slaves and on-disk FMUs, but leave the more advanced stuff to the platforms themselves.
The basic idea is to use URIs to refer to models and slaves. A local FMU URI could for example be
file:///models/my_model.fmu
, while an FMU-proxy remote FMU URI could look likefmu-proxy://sim.example.com:6345?url=http://example.com/my_model.fmu
. A slave URI for an existing DCP slave could bedcp-slave://10.0.0.52:9054
.Based on my definition of "orchestration" further up, we can divide the classes into the same three levels:
model_directory
model
,model_uri_sub_resolver
,model_uri_resolver
slave_uri_sub_resolver
,slave_uri_resolver
We may or may not want/need all levels; that is part of what I'd like to discuss. Should we decide to go further with this, I think the concrete implementations we'd add to CSE Core would include:
fmi::fmu_directory
, implementingmodel_directory
to track on-disk FMUs.fmi::fmu
(already exists) would implementmodel
.file_uri_resolver
, implementingmodel_uri_sub_resolver
to supportfile://
URIs.fmuproxy::remote_fmu
(introduced in PR Feature/160 fmuproxy integration #162) would implementmodel
. This is where Generic FMU interface #165 is actually addressed in the present PR. ;)fmuproxy::uri_resolver
, implementingmodel_uri_sub_resolver
to support e.g.fmu-proxy://
URIs.dcp::slave_uri_resolver
, implementingslave_uri_sub_resolver
to support e.g.dcp-slave://
URIs for already-instantiated DCP slaves.Please destroy. :)