Example #1
0
static unsigned fn2(unsigned n, unsigned m, unsigned seed, unsigned depth, StringBuffer &parentname)
{
    if (!Rconn)
        return 0;
    if ((n+m+seed)%25==0) {
        Rconn->commit();
        Rconn->Release();
        Rconn = querySDS().connect("/DAREGRESS",myProcessSession(), 0, 1000000);
        if (!Rconn) {
            ERROR("Failed to connect to /DAREGRESS");
            return 0;
        }
    }
    IPropertyTree *parent = parentname.length()?Rconn->queryRoot()->queryPropTree(parentname.str()):Rconn->queryRoot();
    if (!parent) {
        ERROR1("Failed to connect to %s",parentname.str());
        Rconn->Release();
        Rconn = NULL;
        return 0;
    }
    __int64 val = parent->getPropInt64("val",0);
    parent->setPropInt64("val",n+val);
    val = parent->getPropInt64("@val",0);
    parent->setPropInt64("@val",m+val);
    val = parent->getPropInt64(NULL,0);
    parent->setPropInt64(NULL,seed+val);
    if (!seed)
        return m+n;
    if (n==m)
        return seed;
    if (depth>10)
        return seed+n+m;
    if (seed%7==n%7)
        return n;
    if (seed%7==m%7)
        return m;
    char name[64];
    unsigned v = seed;
    name[0] = 's';
    name[1] = 'u';
    name[2] = 'b';
    unsigned i = 3;
    while (v) {
        name[i++] = ('A'+v%26 );
        v /= 26;
    }
    name[i] = 0;
    unsigned l = parentname.length();
    if (parentname.length())
        parentname.append('/');
    parentname.append(name);
    IPropertyTree *child = parent->queryPropTree(name);
    if (!child) 
        child = parent->addPropTree(name, createPTree(name));
    unsigned ret = fn2(fn2(n,seed,seed*17+11,depth+1,parentname),fn2(seed,m,seed*11+17,depth+1,parentname),seed*19+7,depth+1,parentname);
    parentname.setLength(l);
    return ret;
}
Example #2
0
    virtual void done()
    {
        StringBuffer scopedName;
        OwnedRoxieString outputName(helper->getOutputName());
        queryThorFileManager().addScope(container.queryJob(), outputName, scopedName);
        Owned<IWorkUnit> wu = &container.queryJob().queryWorkUnit().lock();
        Owned<IWUResult> r = wu->updateResultBySequence(helper->getSequence());
        r->setResultStatus(ResultStatusCalculated);
        r->setResultLogicalName(scopedName.str());
        r.clear();
        wu.clear();

        IPropertyTree &patchProps = patchDesc->queryProperties();
        if (0 != (helper->getFlags() & KDPexpires))
            setExpiryTime(patchProps, helper->getExpiryDays());
        IPropertyTree &originalProps = originalDesc->queryProperties();;
        if (originalProps.queryProp("ECL"))
            patchProps.setProp("ECL", originalProps.queryProp("ECL"));
        if (originalProps.getPropBool("@local"))
            patchProps.setPropBool("@local", true);
        container.queryTempHandler()->registerFile(outputName, container.queryOwner().queryGraphId(), 0, false, WUFileStandard, &clusters);
        Owned<IDistributedFile> patchFile;
        // set part sizes etc
        queryThorFileManager().publish(container.queryJob(), outputName, false, *patchDesc, &patchFile, 0, false);
        try { // set file size
            if (patchFile) {
                __int64 fs = patchFile->getFileSize(true,false);
                if (fs!=-1)
                    patchFile->queryAttributes().setPropInt64("@size",fs);
            }
        }
        catch (IException *e) {
            EXCLOG(e,"keydiff setting file size");
            e->Release();
        }
        // Add a new 'Patch' description to the secondary key.
        DistributedFilePropertyLock lock(newIndexFile);
        IPropertyTree &fileProps = lock.queryAttributes();
        StringBuffer path("Patch[@name=\"");
        path.append(scopedName.str()).append("\"]");
        IPropertyTree *patch = fileProps.queryPropTree(path.str());
        if (!patch) patch = fileProps.addPropTree("Patch", createPTree());
        patch->setProp("@name", scopedName.str());
        unsigned checkSum;
        if (patchFile->getFileCheckSum(checkSum))
            patch->setPropInt64("@checkSum", checkSum);

        IPropertyTree *index = patch->setPropTree("Index", createPTree());
        index->setProp("@name", originalIndexFile->queryLogicalName());
        if (originalIndexFile->getFileCheckSum(checkSum))
            index->setPropInt64("@checkSum", checkSum);
        originalIndexFile->setAccessed();
        newIndexFile->setAccessed();
    }
Example #3
0
void LogicalGraphCreator::beginSubGraph(const char * label, bool nested)
{
    savedGraphId.append(subGraphId);
    if (!nested)
        saveSubGraphs();

    if ((subGraphs.ordinality() == 0) && rootSubGraph)
    {
        subGraphs.append(*LINK(rootSubGraph));
        subGraphId = rootGraphId;
        return;
    }

    subGraphId = ++seq;
    IPropertyTree * node = createPTree("node");
    node = curSubGraph()->addPropTree("node", node);
    node->setPropInt64("@id", subGraphId);

    IPropertyTree * graphAttr = node->addPropTree("att", createPTree("att"));
    IPropertyTree * subGraph = graphAttr->addPropTree("graph", createPTree("graph"));
    subGraphs.append(*LINK(subGraph));
    if (!rootSubGraph)
    {
        rootSubGraph.set(subGraph);
        rootGraphId = subGraphId;
    }
}
void CWSESPControlEx::setSessionTimeout(int timeoutMinutes, IPropertyTree& session)
{
    CDateTime timeNow;
    timeNow.setNow();
    time_t simple = timeNow.getSimple() + timeoutMinutes*60;
    session.setPropInt64(PropSessionTimeoutAt, simple);
    session.setPropBool(PropSessionTimeoutByAdmin, true);
}
Example #5
0
IPropertyTree * addIntraGraphEdge(IPropertyTree * subGraph, unsigned __int64 source, unsigned __int64 target, unsigned outputIndex)
{
    IPropertyTree *edge = createPTree();
    edge->setPropInt64("@target", target);
    edge->setPropInt64("@source", source);

    StringBuffer s;
    edge->setProp("@id", s.append(source).append('_').append(outputIndex).str());
    return subGraph->addPropTree("edge", edge);
}
Example #6
0
IPropertyTree * addInterGraphEdge(IPropertyTree * graph, unsigned __int64 sourceGraph, unsigned __int64 targetGraph, unsigned __int64 sourceActivity, unsigned __int64 targetActivity, unsigned outputIndex)
{
    StringBuffer idText;
    IPropertyTree *edge = createPTree();
    edge->setProp("@id", idText.clear().append(sourceGraph).append('_').append(targetGraph).append("_").append(outputIndex).str());
    edge->setPropInt64("@target", sourceGraph);
    edge->setPropInt64("@source", targetGraph);

    addGraphAttributeInt(edge, "_sourceActivity", sourceActivity);
    addGraphAttributeInt(edge, "_targetActivity", targetActivity);
    return graph->addPropTree("edge", edge);
}
Example #7
0
void addComplexGraphEdge(IPropertyTree * graph, unsigned __int64 sourceGraph, unsigned __int64 targetGraph, unsigned __int64 sourceActivity, unsigned __int64 targetActivity, unsigned outputIndex, IAtom * kind, const char * label)
{
    StringBuffer idText;
    IPropertyTree *edge = createPTree();
    edge->setProp("@id", idText.clear().append(sourceGraph).append('_').append(targetGraph).append("_").append(outputIndex).str());
    edge->setPropInt64("@target", sourceGraph);
    edge->setPropInt64("@source", targetGraph);
    if (label)
        edge->setProp("@label", label);
    if (outputIndex)
        addGraphAttributeInt(edge, "_sourceIndex", outputIndex);

    if (kind == dependencyAtom)
        addGraphAttributeBool(edge, "_dependsOn", true);

    addGraphAttributeInt(edge, "_sourceActivity", sourceActivity);
    addGraphAttributeInt(edge, "_targetActivity", targetActivity);
    graph->addPropTree("edge", edge);
}
Example #8
0
void addSimpleGraphEdge(IPropertyTree * subGraph, unsigned __int64 source, unsigned __int64 target, unsigned outputIndex, unsigned inputIndex, IAtom * kind, const char * label, bool nWay)
{
    IPropertyTree *edge = createPTree();
    edge->setPropInt64("@target", target);
    edge->setPropInt64("@source", source);
    if (outputIndex != 0)
        addGraphAttributeInt(edge, "_sourceIndex", outputIndex);
    if (inputIndex != 0)
        addGraphAttributeInt(edge, "_targetIndex", inputIndex);
    if (label)
        edge->setProp("@label", label);

    if (kind == dependencyAtom)
        addGraphAttributeBool(edge, "_dependsOn", true);

    if (nWay)
        edge->setPropBool("@nWay", true);

    StringBuffer s;
    edge->setProp("@id", s.append(source).append('_').append(outputIndex).str());
    subGraph->addPropTree("edge", edge);
}