Commit 1caf9132 authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Merge branch feature/jorgen.lind/2.1.6 with refs/heads/2.1 into refs/merge-requests/444/train

parents e695eebb 655902a6
Pipeline #57136 passed with stages
in 15 minutes and 18 seconds
......@@ -5,7 +5,7 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
set(OpenVDSVersion 2.1.5)
set(OpenVDSVersion 2.1.6)
project(OpenVDS VERSION ${OpenVDSVersion})
......
......@@ -189,7 +189,7 @@ PyGlobal::initModule(py::module& m)
DMSOpenOptions_(m,"DMSOpenOptions", OPENVDS_DOCSTRING(DMSOpenOptions));
DMSOpenOptions_.def(py::init< >(), OPENVDS_DOCSTRING(DMSOpenOptions_DMSOpenOptions));
DMSOpenOptions_.def(py::init<const std::string &, const std::string &, const std::string &, const std::string &, int, const std::string &, const std::string &, const std::string &, const std::string &>(), py::arg("sdAuthorityUrl").none(false), py::arg("sdApiKey").none(false), py::arg("sdToken").none(false), py::arg("datasetPath").none(false), py::arg("logLevel").none(false), py::arg("authTokenUrl").none(false), py::arg("refreshToken").none(false), py::arg("clientId").none(false), py::arg("clientSecret").none(false), OPENVDS_DOCSTRING(DMSOpenOptions_DMSOpenOptions_2));
DMSOpenOptions_.def(py::init<const std::string &, const std::string &, const std::string &, const std::string &, int, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &, bool>(), py::arg("sdAuthorityUrl").none(false), py::arg("sdApiKey").none(false), py::arg("sdToken").none(false), py::arg("datasetPath").none(false), py::arg("logLevel").none(false), py::arg("authTokenUrl").none(false), py::arg("refreshToken").none(false), py::arg("clientId").none(false), py::arg("clientSecret").none(false), py::arg("scopes").none(false), py::arg("useFileNameForSingleFileDatasets") = false, OPENVDS_DOCSTRING(DMSOpenOptions_DMSOpenOptions_2));
DMSOpenOptions_.def_readwrite("sdAuthorityUrl" , &DMSOpenOptions::sdAuthorityUrl, OPENVDS_DOCSTRING(DMSOpenOptions_sdAuthorityUrl));
DMSOpenOptions_.def_readwrite("sdApiKey" , &DMSOpenOptions::sdApiKey , OPENVDS_DOCSTRING(DMSOpenOptions_sdApiKey));
DMSOpenOptions_.def_readwrite("sdToken" , &DMSOpenOptions::sdToken , OPENVDS_DOCSTRING(DMSOpenOptions_sdToken));
......@@ -199,6 +199,8 @@ PyGlobal::initModule(py::module& m)
DMSOpenOptions_.def_readwrite("refreshToken" , &DMSOpenOptions::refreshToken , OPENVDS_DOCSTRING(DMSOpenOptions_refreshToken));
DMSOpenOptions_.def_readwrite("clientId" , &DMSOpenOptions::clientId , OPENVDS_DOCSTRING(DMSOpenOptions_clientId));
DMSOpenOptions_.def_readwrite("clientSecret" , &DMSOpenOptions::clientSecret , OPENVDS_DOCSTRING(DMSOpenOptions_clientSecret));
DMSOpenOptions_.def_readwrite("scopes" , &DMSOpenOptions::scopes , OPENVDS_DOCSTRING(DMSOpenOptions_scopes));
DMSOpenOptions_.def_readwrite("useFileNameForSingleFileDatasets", &DMSOpenOptions::useFileNameForSingleFileDatasets, OPENVDS_DOCSTRING(DMSOpenOptions_useFileNameForSingleFileDatasets));
// HttpOpenOptions
py::class_<HttpOpenOptions, OpenOptions>
......
......@@ -89,7 +89,7 @@ PyVolumeData::initModule(py::module& m)
CompressionMethod_.value("WaveletNormalizeBlockLossless", CompressionMethod::WaveletNormalizeBlockLossless, OPENVDS_DOCSTRING(CompressionMethod_WaveletNormalizeBlockLossless));
m.def("compressionMethod_IsWavelet" , static_cast<bool(*)(native::CompressionMethod)>(&CompressionMethod_IsWavelet), py::arg("compressionMethod").none(false), py::call_guard<py::gil_scoped_release>(), OPENVDS_DOCSTRING(CompressionMethod_IsWavelet));
m.def("getLODSize" , static_cast<int(*)(int, int, int, bool)>(&GetLODSize), py::arg("voxelMin").none(false), py::arg("voxelMax").none(false), py::arg("lod").none(false), py::arg("includePartialUpperVoxel") = true, py::call_guard<py::gil_scoped_release>(), OPENVDS_DOCSTRING(GetLODSize));
m.def("getLODSize" , static_cast<int(*)(int, int, int, bool)>(&GetLODSize), py::arg("voxelMin").none(false), py::arg("voxelMax").none(false), py::arg("LOD").none(false), py::arg("includePartialUpperVoxel") = true, py::call_guard<py::gil_scoped_release>(), OPENVDS_DOCSTRING(GetLODSize));
//AUTOGEN-END
}
......@@ -688,12 +688,16 @@ static const char *__doc_OpenVDS_DMSOpenOptions_logLevel = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_refreshToken = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_scopes = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_sdApiKey = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_sdAuthorityUrl = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_sdToken = R"doc()doc";
static const char *__doc_OpenVDS_DMSOpenOptions_useFileNameForSingleFileDatasets = R"doc()doc";
static const char *__doc_OpenVDS_DimensionsND = R"doc(2D or 3D dimension group\n)doc";
static const char *__doc_OpenVDS_DimensionsND_Dimensions_01 = R"doc()doc";
......@@ -871,8 +875,12 @@ includePartialUpperVoxel :
Returns:
--------
The number of voxels at the given LOD, at LOD 0 the result is
voxelMax - voxelMin.)doc";
$LOD :
The LOD level for which the size is requested.
The number of voxels at the given LOD, at LOD 0 the result is voxelMax
- voxelMin.)doc";
static const char *__doc_OpenVDS_GetLayout =
R"doc(Get the VolumeDataLayout for a VDS
......@@ -2584,8 +2592,6 @@ static const char *__doc_OpenVDS_OpenOptions_ConnectionType_Azure = R"doc()doc";
static const char *__doc_OpenVDS_OpenOptions_ConnectionType_AzurePresigned = R"doc()doc";
static const char *__doc_OpenVDS_OpenOptions_ConnectionType_AzureSdkForCpp = R"doc()doc";
static const char *__doc_OpenVDS_OpenOptions_ConnectionType_ConnectionTypeCount = R"doc()doc";
static const char *__doc_OpenVDS_OpenOptions_ConnectionType_DMS = R"doc()doc";
......
......@@ -190,9 +190,10 @@ namespace OpenVDS
IOManagerDms::IOManagerDms(const DMSOpenOptions& openOptions, IOManager::AccessPattern accessPatttern, Error& error)
: IOManager(openOptions.connectionType)
, m_opened(false)
, m_useFileNameForSingleFileDatasets(openOptions.useFileNameForSingleFileDatasets)
, m_threadPool(16)
{
if (openOptions.datasetPath.size())
if (openOptions.datasetPath.size() && m_useFileNameForSingleFileDatasets)
{
auto it = openOptions.datasetPath.rfind('/');
if (it == openOptions.datasetPath.size() - 1)
......@@ -204,6 +205,10 @@ namespace OpenVDS
m_filename = openOptions.datasetPath.substr(it+1);
}
}
else
{
m_filename = "0";
}
try {
......
......@@ -82,9 +82,11 @@ namespace OpenVDS
std::unique_ptr<seismicdrive::SDGenericDataset> m_dataset;
std::string m_filename;
bool m_opened;
bool m_useFileNameForSingleFileDatasets;
ThreadPool m_threadPool;
std::unique_ptr<CurlHandler> m_curlHandler;
std::unique_ptr<TokenRefresher> m_tokenRefresher;
};
}
......
......@@ -93,6 +93,22 @@ static std::string urlDecode(const StringWrapper& url)
return std::string(output.data(), output.data() + output.size());
}
static bool isTrue(const std::string& str)
{
auto value = str;
std::transform(value.begin(), value.end(), value.begin(), asciitolower);
static const std::string trueValues[] = { "1", "on", "true", "yes" };
for (auto& trueValue : trueValues)
{
if (value == trueValue)
{
return true;
}
}
return false;
}
static std::unique_ptr<OpenOptions> createS3OpenOptions(const StringWrapper &url, const StringWrapper &connectionString, Error &error)
{
std::unique_ptr<AWSOpenOptions> openOptions(new AWSOpenOptions());
......@@ -175,18 +191,7 @@ static std::unique_ptr<OpenOptions> createS3OpenOptions(const StringWrapper &url
}
else if (connectionPair.first == "disableinitapi" || connectionPair.first == "disable_init_api")
{
auto value = connectionPair.second;
std::transform(value.begin(), value.end(), value.begin(), asciitolower);
static const std::string trueValues[] = { "1", "on", "true", "yes" };
openOptions->disableInitApi = false;
for (auto& trueValue : trueValues)
{
if (value == trueValue)
{
openOptions->disableInitApi = true;
break;
}
}
openOptions->disableInitApi = isTrue(connectionPair.second);
}
else
{
......@@ -389,6 +394,9 @@ static std::unique_ptr<OpenOptions> createDMSOpenOptions(const StringWrapper& ur
openOptions->clientSecret = connectionPair.second;
if (connectionPair.first == "scopes")
openOptions->scopes = connectionPair.second;
if (connectionPair.first == "usefilenameforsinglefiledatasets" || connectionPair.first == "use_file_name_for_single_file_datasets"
|| connectionPair.first == "use_filename_for_single_file_datasets")
openOptions->useFileNameForSingleFileDatasets = isTrue(connectionPair.second);
}
return openOptions;
......
......@@ -454,9 +454,9 @@ struct GoogleOpenOptions : OpenOptions
struct DMSOpenOptions : OpenOptions
{
DMSOpenOptions() : OpenOptions(DMS), logLevel(0) {}
DMSOpenOptions() : OpenOptions(DMS), logLevel(0), useFileNameForSingleFileDatasets(false) {}
DMSOpenOptions(std::string const& sdAuthorityUrl, std::string const& sdApiKey, std::string const &sdToken, std::string const &datasetPath, int logLevel, std::string const &authTokenUrl = std::string(), std::string const &refreshToken = std::string(), std::string const &clientId = std::string(), std::string const &clientSecret = std::string(), std::string const &scopes = std::string())
DMSOpenOptions(std::string const& sdAuthorityUrl, std::string const& sdApiKey, std::string const &sdToken, std::string const &datasetPath, int logLevel, std::string const &authTokenUrl = std::string(), std::string const &refreshToken = std::string(), std::string const &clientId = std::string(), std::string const &clientSecret = std::string(), std::string const &scopes = std::string(), bool useFileNameForSingleFileDatasets = false)
: OpenOptions(DMS)
, sdAuthorityUrl(sdAuthorityUrl)
, sdApiKey(sdApiKey)
......@@ -468,6 +468,7 @@ struct DMSOpenOptions : OpenOptions
, clientId(clientId)
, clientSecret(clientSecret)
, scopes(scopes)
, useFileNameForSingleFileDatasets(useFileNameForSingleFileDatasets)
{}
std::string sdAuthorityUrl;
......@@ -480,6 +481,7 @@ struct DMSOpenOptions : OpenOptions
std::string clientId;
std::string clientSecret;
std::string scopes;
bool useFileNameForSingleFileDatasets;
};
/// <summary>
......
......@@ -40,7 +40,7 @@ static int32_t omp_get_max_threads()
static int32_t omp_get_thread_num()
{
return 1;
return 0;
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment