Beispiel #1
0
void dtkDistributedSlave::connectFromJob(const QUrl& server)
{
    dtkDistributedCommunicator *comm = dtkDistributed::communicator::instance();

    if (comm->rank() == 0) {
        // the server waits for the jobid in stdout
        std::cout << QString("DTK_JOBID="+jobId()).toStdString() << std::endl << std::flush;

        QUrl url(server);

        dtkDebug() << "Running on master, connect to remote server" << server;
        connect(url);
        dtkDebug() << "slave connected to server " << isConnected();

        if (isConnected()) {
            dtkDistributedMessage msg(dtkDistributedMessage::SETRANK,jobId(),dtkDistributedMessage::SLAVE_RANK);
            msg.send(socket());
        }
    }
}
Beispiel #2
0
void dtkDistributedSlave::disconnectFromJob(const QUrl& server)
{
    dtkDistributedCommunicator *comm = dtkDistributed::communicator::instance();

    if (comm->rank() == 0) {
        if (isConnected()) {
            dtkDistributedMessage msg(dtkDistributedMessage::ENDJOB,jobId(),dtkDistributedMessage::SLAVE_RANK);
            msg.send(socket());
        }
        disconnect(server);
    }
}
// --------------------------------------------------------------------------
// void CNSmlSOSHandler::CreateJobL( CNSmlAlertJobInfo& aJobInfo )
// Creates server alerted job got from message queue.
// --------------------------------------------------------------------------
//
void CNSmlSOSHandler::CreateJobL( CNSmlAlertJobInfo& aJobInfo )
    {
    CNSmlJob* job = new (ELeave) CNSmlJob;
    CleanupStack::PushL(job);
    job->SetProfId( aJobInfo.iProfileId );
    job->SetTransportId( aJobInfo.iTransportId );
    job->SetUsageType( aJobInfo.iType );
    job->iUimode = aJobInfo.iUimode;   
    if ( aJobInfo.iType == ESmlDataSync )
        {        
        if ( aJobInfo.iPackage.Length() )
            {
            job->iPackage = aJobInfo.iPackage.AllocL();
            job->iSessionId = aJobInfo.iSessionId;
            }
            
        job->iCtInfo = new (ELeave) CArrayFixFlat<TNSmlContentTypeInfo>(1);

        for ( TInt i=0 ; i < aJobInfo.iContentType->Count() ; i++ )
            {
            job->AddTaskIdL( aJobInfo.iContentType->At(i).iTaskId);
            job->iCtInfo->AppendL( aJobInfo.iContentType->At(i) );
            }

        job->SetJobType( EDSJobTaskTransST );
        
        CNSmlDSSettings* settings = CNSmlDSSettings::NewLC();
        CNSmlDSProfile* prof = settings->ProfileL( aJobInfo.iProfileId );
        if ( prof )
            {
            if ( !prof->IntValue( EDSProfileHidden ) )
                {
                job->iPending = ETrue; // Notifier is not called if profile is hidden.
                }
            delete prof;
            prof = NULL;
            }
        CleanupStack::PopAndDestroy(settings);
        }
    else  // ESmlDevMan
        {
        job->SetJobType( EDMJobTransport );
        CNSmlDMSettings* settings = CNSmlDMSettings::NewLC();
        CNSmlDMProfile* prof = settings->ProfileL( aJobInfo.iProfileId );
        if ( prof )
            {
            if ( !prof->IntValue( EDMProfileHidden ) )
                {
                job->iPending = ETrue; // Notifier is not called if profile is hidden.
                }
            delete prof;
            prof = NULL;
            }
        CleanupStack::PopAndDestroy(settings);
        }        

    TInt jobId(0);
    // Add created job to the queue.
    AddJobL( job, jobId );
    CleanupStack::Pop(job);
    }
Beispiel #4
0
BatchJob::BatchJob(const QString &dir)
    : workingDirectory_(dir),
      process(NULL)
{
    setJobId();
    logFile = Application::instance()->jobLogsDirectory().absoluteFilePath(QString("mifit%1.log").arg(jobId()));
}