Skip to content

Commit

Permalink
Merge pull request #780 from skadefro/master
Browse files Browse the repository at this point in the history
minor updates
  • Loading branch information
skadefro authored Oct 1, 2023
2 parents cca4e73 + 3020d85 commit 4ce1914
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 153 deletions.
4 changes: 2 additions & 2 deletions OpenRPA.Interfaces/IPCService/OpenRPAService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ public void StartWorkflowInstances()
{
designer.BreakpointLocations = null;
// instance = workflow.CreateInstance(Arguments, null, null, designer.IdleOrComplete, designer.OnVisualTracking);
instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, designer.OnVisualTracking);
instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, designer.OnVisualTracking, 0);
}
else
{
instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, null);
instance = workflow.CreateInstance(_instance.Value.Arguments, null, null, IdleOrComplete, null, 0);
}
instance.caller = _instance.Value.UniqueId;

Expand Down
2 changes: 1 addition & 1 deletion OpenRPA.Interfaces/IWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IWorkflow : IProjectableBase
bool background { get; set; }
string ProjectAndName { get; set; }
List<workflowparameter> Parameters { get; set; }
IWorkflowInstance CreateInstance(Dictionary<string, object> Parameters, string queuename, string correlationId, idleOrComplete idleOrComplete, VisualTrackingHandler VisualTracking);
IWorkflowInstance CreateInstance(Dictionary<string, object> Parameters, string queuename, string correlationId, idleOrComplete idleOrComplete, VisualTrackingHandler VisualTracking, int ident);
string UniqueFilename();
Task Delete(bool skipOnline = false);
Task Save(bool skipOnline = false);
Expand Down
9 changes: 6 additions & 3 deletions OpenRPA.Script/Activities/InvokeCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,13 @@ public void Execute(CodeActivityContext context, string code, string language, D
System.IO.Directory.SetCurrentDirectory(path);
}

bool doRelease = false;
//bool doRelease = false;
IntPtr lck = IntPtr.Zero;
try
{
InitPython();
// lck = PythonEngine.AcquireLock();
doRelease = true;
//doRelease = true;
using (Python.Runtime.Py.GIL())
{
//// create a Python scope
Expand Down Expand Up @@ -627,7 +627,10 @@ public void CompileAndRun(string language, string code, string[] references, Dic
}
throw new Exception(text);
}
cache.Add(code, compile);
if(!cache.ContainsKey(code))
{
cache.Add(code, compile);
}
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion OpenRPA.Script/Activities/ParseUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ public static JObject PyDictToJObjectWithGIL(PyDict dict)
public static JObject PyDictToJObject(PyDict dict)
{
JObject jobj = new JObject();
foreach(var key in dict.Keys())
foreach(object _key in dict.Keys())
{
var key = _key.ToString();
PyObject pyobj = dict.GetItem(key);
JToken value;
if (pyobj.IsNone())
Expand Down
4 changes: 2 additions & 2 deletions OpenRPA/Activities/InvokeOpenRPA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ protected override void Execute(NativeActivityContext context)
if (designer != null)
{
designer.BreakpointLocations = null;
instance = workflow.CreateInstance(param, null, null, designer.IdleOrComplete, designer.OnVisualTracking);
instance = workflow.CreateInstance(param, null, null, designer.IdleOrComplete, designer.OnVisualTracking, myinstance.ident + 1);
}
else
{
instance = workflow.CreateInstance(param, null, null, RobotInstance.instance.Window.IdleOrComplete, null);
instance = workflow.CreateInstance(param, null, null, RobotInstance.instance.Window.IdleOrComplete, null, myinstance.ident + 1);
}
instance.caller = WorkflowInstanceId;
if (!string.IsNullOrEmpty(traceId)) instance.TraceId = traceId;
Expand Down
2 changes: 1 addition & 1 deletion OpenRPA/AgentWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ internal void OnPlay(object _item)
GenericTools.Minimize();
IWorkflowInstance instance;
var param = new Dictionary<string, object>();
instance = workflow.CreateInstance(param, null, null, IdleOrComplete, null);
instance = workflow.CreateInstance(param, null, null, IdleOrComplete, null, 0);
instance.Run();
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions OpenRPA/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2652,13 +2652,13 @@ internal async void OnPlay(object _item)
if (RobotInstance.instance.GetWorkflowDesignerByIDOrRelativeFilename(workflow.IDOrRelativeFilename) is Views.WFDesigner designer)
{
designer.BreakpointLocations = null;
instance = workflow.CreateInstance(param, null, null, new idleOrComplete(designer.IdleOrComplete), designer.OnVisualTracking);
instance = workflow.CreateInstance(param, null, null, new idleOrComplete(designer.IdleOrComplete), designer.OnVisualTracking, 0);
designer.SetDebugLocation(null);
designer.Run(VisualTracking, SlowMotion, instance);
}
else
{
instance = workflow.CreateInstance(param, null, null, IdleOrComplete, null);
instance = workflow.CreateInstance(param, null, null, IdleOrComplete, null, 0);
instance.Run();
}
}
Expand Down
8 changes: 5 additions & 3 deletions OpenRPA/RobotInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ await GenericTools.RunUIAsync(async () =>
}
}
var localInstances = dbWorkflowInstances.Find(x => x.isDirty || x.isLocalOnly).ToList();
localInstances = localInstances.OrderBy(x => x.ident).ToList();
foreach (var i in localInstances)
{
await i.Save<WorkflowInstance>();
Expand All @@ -953,8 +954,9 @@ await GenericTools.RunUIAsync(async () =>
Log.Debug("RunPendingInstances::end ");
if(first_connect)
{
foreach (var i in WorkflowInstance.Instances)
foreach (var i in WorkflowInstance.Instances.OrderBy(x => x.ident).ToList())
{
var ident = i.ident;
if (i.Bookmarks != null && i.Bookmarks.Count > 0)
{
foreach (var b in i.Bookmarks)
Expand Down Expand Up @@ -1864,14 +1866,14 @@ private async void WebSocketClient_OnQueueMessage(IQueueMessage message, QueueMe
if (RobotInstance.instance.GetWorkflowDesignerByIDOrRelativeFilename(command.workflowid) is Views.WFDesigner designer)
{
designer.BreakpointLocations = null;
instance = workflow.CreateInstance(param, message.replyto, message.correlationId, designer.IdleOrComplete, designer.OnVisualTracking);
instance = workflow.CreateInstance(param, message.replyto, message.correlationId, designer.IdleOrComplete, designer.OnVisualTracking, 0);
(instance as WorkflowInstance).TraceId = command.traceId;
(instance as WorkflowInstance).SpanId = command.spanId;
designer.Run(Window.VisualTracking, Window.SlowMotion, instance);
}
else
{
instance = workflow.CreateInstance(param, message.replyto, message.correlationId, Window.IdleOrComplete, null);
instance = workflow.CreateInstance(param, message.replyto, message.correlationId, Window.IdleOrComplete, null, 0);
(instance as WorkflowInstance).TraceId = command.traceId;
(instance as WorkflowInstance).SpanId = command.spanId;
instance.Run();
Expand Down
Loading

0 comments on commit 4ce1914

Please sign in to comment.