HRESULT = 0x80131902 when using Ischeduler.connect
I am trying to connect to an HPC window using C ++ with the code I pulled from https://msdn.microsoft.com/en-us/library/cc853425(v=vs.85).aspx
in the test project everything worked well, but when I tried to copy paste to my main project, I started getting 0x80131902 from the pScheduler-> Connect line.
I tried to match all the project settings, commented out all the code, but this is still the same error. It gets to the point where I contemplate rebuilding my main project from scratch, but it's a big and confusing mess that I would rather avoid, if at all possible.
Has anyone encountered this problem?
// The Microsoft.Hpc.Scheduler.tlb and Microsoft.Hpc.Scheduler.Properties.tlb type
// libraries are included in the Microsoft HPC Pack 2008 SDK. The type libraries are
// located in the "Microsoft HPC Pack 2008 SDK\Lib\i386" or \amd64 folder. Include the rename
// attributes to avoid name collisions.
#include <windows.h>
#include <stdio.h>
#import <C:\Program Files\Microsoft HPC Pack 2008 R2\Bin\Microsoft.Hpc.Scheduler.tlb> named_guids no_namespace raw_interfaces_only \
rename("SetEnvironmentVariable","SetHpcEnvironmentVariable") \
rename("AddJob", "AddHpcJob")
#import <C:\Program Files\Microsoft HPC Pack 2008 R2\Bin\Microsoft.Hpc.Scheduler.Properties.tlb> named_guids no_namespace raw_interfaces_only
void connectToHPC(const char* ServerName)
{
HRESULT hr = S_OK;
IScheduler* pScheduler = NULL;
ISchedulerCollection* pJobs = NULL;
IIntCollection* pJobIds = NULL;
IFilterCollection* pFilters = NULL;
VARIANT var;
long count = 0;
long jobId = 0;
long* retVal = nullptr;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// Get an instance of the Scheduler object.
hr = CoCreateInstance( __uuidof(Scheduler), // CLSID_Scheduler,
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IScheduler), // IID_IScheduler,
reinterpret_cast<void **> (&pScheduler) );
if (FAILED(hr))
{
wprintf(L"CoCreateInstance(IScheduler) failed with 0x%x.\n", hr);
goto cleanup;
}
hr = pScheduler->Connect(_bstr_t(ServerName));
if (FAILED(hr))
{
wprintf(L"Unable to connect to cluster %s. Failed with 0x%x.\n", ServerName, hr);
goto cleanup;
}
cleanup:
// Before exiting, release your instance of IScheduler.
if (pScheduler)
pScheduler->Release();
CoUninitialize();
}
+3
source to share
No one has answered this question yet
Check out similar questions: