Giter Club home page Giter Club logo

dotnet-rbroker-framework's Introduction

.NET RBroker Framework for DeployR

The .NET RBroker Framework provides a simple yet powerful API that supports the rapid integration of R Analytics inside any .NET application. Simply define an RTask, submit your task to an instance of RBroker and be notified when your RTaskResult is available.

The framework scales effortlessly to support simple integrations through sophisticated solutions such as high throughput, realtime scoring engines.

Links

Dependencies

Bundled DLL Dependencies

Besides the DeployR .NET RBroker Framework DLL itself, DeployRBroker<version>.dll, the framework depends on the DeployR .NET Client Library and all of it's third party DLL dependencies.

Building the .NET RBroker Framework

The DeployR .NET RBroker Framework was created with Visual Studio 2013, using .NET Framework 4.5.1.

A successful build will result in the creation of DeployR-DotNet-RBroker-<version>.zip file containing the DeployR RBroker Framework library and it's dependencies. It will also create a DeployRBroker.chm help file.

Please review the variables in the build.bat file and adjust as necessary for your environemnt. The one variable that requires special attnetion is BROKER_LIB_REF_PATH. This variable points to the directory containing the previosuly built DeployR client library DeployR<version>.dll

Examples

The DeployR .NET RBroker Framework ships with a number of sample applications provided to demonstrate some of the key featues introduced by the Quick Start Tutorial for the .NET client library. See here for details.

Help

The DeoployR .NET help file is built with Sandcastle Help File Builder. The file "deployR.shfbproj", is a "Sandcastle Help File Builder" project file

Sandcastle Help File Builder

License

Copyright (C) 2010-2015 by Microsoft Corporation

This program is licensed to you under the terms of Version 2.0 of the Apache License. This program is distributed WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) for more details.

dotnet-rbroker-framework's People

Contributors

dec100 avatar microsoft-github-policy-service[bot] avatar swells avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-rbroker-framework's Issues

Vector with one element returns "RNumeric", while vector with many elements returns "RNumericVector"

When getting the result of the generated objects, a vector with one element returns "RNumeric", while vector with many elements returns "RNumericVector". I believe both should return "RNumericVector".

In the R script I am type casting to vector:

newscale <- as.vector(results$par)

When I get the generated objects, I am having to check the type before I place the objects into a List.

RTaskToken rTaskToken = rBroker.submit(rTask);
RTaskResult rTaskResult = rTaskToken.getResult();
foreach (var rslt in rTaskResult.getGeneratedObjects())
{
    if (rslt.Name.ToLower().Equals("newscale"))
    {
        var rsltList = new List<double?>();
        if (rslt.RClass == "numeric" && rslt.Type == "primitive")
        {
            rsltList.Add((double?)rslt.Value);
        }
        else
        {
            rsltList = ((IEnumerable<double?>)rslt.Value).ToList();
        }
    }
}

System.Exception: RBrokerEngine: taskTokenListener callback not found for DeployRBroker.PooledTask, unexpected error.

When I'm doing many concurrent pooled task execution using single RBroker, sometimes RBrokerWorkerManager method fails with an exception:

Exception: Exception thrown: 'System.Exception' in DeployRBroker8.0.5.dll ("RBrokerEngine: brokerEngineExecutor.run ex=System.Exception: RBrokerEngine: processing task DeployRBroker.PooledTask, ex=System.Exception: RBrokerEngine: taskTokenListener callback not found for DeployRBroker.PooledTask, unexpected error. at DeployRBroker.RBrokerEngine.RBrokerWorkerManager() at DeployRBroker.RBrokerEngine.RBrokerWorkerManager()"). Exception thrown: 'System.Exception' in DeployRBroker8.0.5.dll ("RBrokerEngine: brokerEngineExecutor.run ex=System.Exception: RBrokerEngine: processing task DeployRBroker.PooledTask, ex=System.Exception: RBrokerEngine: taskTokenListener callback not found for DeployRBroker.PooledTask, unexpected error. at DeployRBroker.RBrokerEngine.RBrokerWorkerManager() at DeployRBroker.RBrokerEngine.RBrokerWorkerManager()")

Once the RBrokerWorkerManager method throws the exception, RBroker basically stops task processing and new tasks keep queuing.
I tested on series of 100 concurrent calls with parallelTaskLimit = 6.

It happens sometimes in case when a task has been sent to submit and was successfully added into pending tasks queue (m_pendingHighPriorityQueue/m_pendingLowPriorityQueue). At the same time the task could be picked up in different thread by RBrokerWorkerManager, although the task was not completely submitted yet. In some cases RBrokerWorkerManager tries to take the task token listener from m_taskTokenListenerMapbefore it was created and added there in submit method. So it cause that m_taskTokenListenerMap.TryRemove returns null since such key was not found. Then RBrokerWorkerManager throws an exception, which I described above.
I haven't found any logic that would restart RBrokerWorkerManager to continue task processing after failure.

Assuming that I see two point to improve:

  1. RBrokerWorkerManager should restart after fail
  2. A task and its result token object should be added to the m_taskTokenListenerMap dictionary before the task would be queued to process.

RBrokerListenerManager is loosing task results

Hi! It's me again.

As you know the RBrokerListenerManagermethod, which handles task result, iterates m_liveTaskTokensqueue by task token. If current task is done, it invokes onTaskCompletedfor this task and removes a task from head of the m_liveTaskTokens queue. This logic works fine while all tasks are done or were executed in single thread or one by one. But once one of tasks is not done, this task continue to be the first to out and will be removed from the queue with next completed task. Consequently some of task would not be notified as completed and some would be handled twice or more times.
So using for this case a queue is definitely wrong approach. Please replace ConcurrentBag<RTaskToken>with a ConcurrentDictionary<RTaskToken, RTask>, which supports direct remove a particular instance.

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.