Alfresco Script set group as assignee - javascript

I'm using alfresco script and I'm starting a workflow using a script. I'm setting group assignee as reception:
wfparams["bpm:groupasignee"] = groups.getGroup('reception');
And starting workflow:
workflowAction.startWorkflow(package, wfparams);
Problem is showing in console:
org.springframework.extensions.webscripts.WebScriptException: 04120017 Wrapped Exception (with status template): 04120067 Failed to execute script 'Javascript Console Script': 04120066 Failed to start workflow activiti$activitiParallelGroupReview:1:20.
Cause by:
org.activiti.engine.ActivitiException: Couldn't serialize
value
'[org.alfresco.repo.security.authority.script.ScriptUser#36e9c1f8]' in
variable 'bpm_groupasignee'
How to assign a group to a workflow task?
Greetings, RafaƂ

You can not assign task to group, using script.Below is the code i have taken it from bpmn file, where activiti:candidateGroups="GROUP_GroupName" used to assign task to Group.In alfresco group are prefixed in backend as "GROUP_ ",so i think you have to assign task to "GROUP_reception".
<userTask id="PE" name="PE" activiti:candidateGroups="GROUP_PE" activiti:formKey="wf:adhocTask"></userTask>

please try using this to assign a workflow to a group
wfparams["bpm:groupAssignee"] = people.getGroup("GROUP_YOUR_GROUP_NAME");

Related

Uncaught (in promise) Error: Provided weight data has no target variable: block1_conv1_2/kernel

I am new to machine learning and I was following this blog on how to write a model with mobilenet.
I managed to convert the .h5 file model and tried to implement it
on my web app.
Unfortunately, when I try to load the JSON model I get this error:
Uncaught (in promise) Error: Provided weight data has no target
variable: block1_conv1_2/kernel.
Screenshot of the error on a browser
I converted the .h5 model in the command line like so:
tensorflowjs_converter --input_format keras model.h5 ConvertedModel/
The code to load the model in the browser, I followed this blog
let model;
async function loadModel(name) {
$(".progress-bar").show();
model = undefined;
model = await tf.loadModel(`ConvertedModel/model.json`);
$(".progress-bar").hide();
}
To see the code of the model please refer to the blog link.
But below is a screenshot of how the model is compiled.
Model compilation
Dependencies:
Tensorflow 1.13.1
Python 3.6.0
tensorflowjs 1.0.1
Any help to fix this would be appreciated. Thank you so much.
It seems you've encountered this error where an extra suffix has been added to some of your weights.
You can work around this issue by manually removing these extra suffixes from your model.json:
block1_conv1_2/kernel
should instead be:
block1_conv1/kernel
The 'Error in clip' bug has now been fixed so I'm not too sure why you've received this one, but once again you can work around this by manually editing the model.json, and changing every instance of:
{"type":"ndarray", "value":6}
to
6

Passing only the required rows of data from CSV file to Jmeter based on a criteria

I have a csv file which has the input in the below format (It has no headers as first row):
India,QA,1200,
India,QA1,1201,
India,QA2,1202,
USA,Dev1,5580,
USA,Dev2,5580,
AUS,Dev3,3300,
AUS,Dev4,3301,
I have configured the CSV Data Set Config component and have given the respective path and variable name details. Snapshot below:
from the command line argument, i will be invoking the Jmeter jmeter.bat -t C:\Users\Dev\Desktop\JI\testscript.jmx -JCountry=Indiawhich also has a parameter called JCountry=India.
Now, I have to use this value (India) and then search the csv file's first column and if it matches, I need to send only those particular rows matching to the country name given from the cmd to the script.
I thought of using If Controller but how can I check the csv files first row and when there is a match, send those details to the script.
The easiest option would be dynamically generating a CSV file with only India lines
Add setUp Thread Group to your Test Plan
Add Test Action sampler to the setUp Thread Group (this way you won't have an extra result in .jtl file)
Add JSR223 PreProcessor as a child of the Test Action Sampler
Put the following code into "Script" area:
String country = props.get('Country')
def originalCsvFile = new File('C:/Users/Dev/Desktop/JI/JVMDetails/Details.txt')
def countryCsvFile = new File('C:/Users/Dev/Desktop/JI/JVMDetails/Country.txt')
countryCsvFile.delete()
originalCsvFile.eachLine {line ->
if (line.startsWith(country)) {
countryCsvFile << line
countryCsvFile << System.getProperty('line.separator')
}
}
Configure your CSV Data Set Config to use C:\Users\Dev\Desktop\JI\JVMDetails\Country.txt as this file will have only those lines which start with what you have defined as Country property
More information:
Apache Groovy - Why and How You Should Use It
Groovy Goodness: Working with Files
You need to loop through CSV, see example or other examples.
As the second example use in while condition the variable from CSV: ${Country} .
Inside loop you need to add If Controller with condition to compare country variable against country property:
${__jexl3("${__P{Country}" == "${Country}")}
Checking this and using __jexl3 or __groovy function in Condition is advised for performances

Multiple edge creation - Gremlin REST server

I am using a simple Gremlin RESTful server and I am sending simple commands inside a POST request. For example, if I want to create edges (in my specific format), I have the following template:
const nodeCommandFormat = "graph.addVertex('%s', '%s', 'evid', '%s');";
Sending a long string with chained commands like this works fine, all the edges are created. My question is: why it does not work with the edges creation? Until now, I tried with this two commands:
const newEdgeCommandFormat = "g.V().has('evid', '%s').addE('next').to(g.V().has('evid', '%s')).property('count', 1);";
or
x = g.V().has('evid', ...).next(); y = g.V().has('evid', ...).next(); x.addEdge('next', y, 'count', 1);
However, if I concatenate 100 commands like this, only the edge corresponding to the last command is created. Why is that? On the other hand, I also receive errors like this:
Using first type of edge creation: [WARN] HttpGremlinEndpointHandler - Invalid request - responding with 500 Internal Server Error and The provided traverser does not map to a value: v[3091]->[TinkerGraphStep(vertex,[evid.eq(6ba0b28797dd79a2ee198d8ff280c4ff)])]
Using the second type of edge creation: java.util.NoSuchElementException
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:204)
How do I achive dynamic edge creation using Gremlin REST server?
P.S. All my nodes have "evid" property (event-id) which is the md5 value of an object. I use this as an identifier for my nodes.
Thank you!
.iterate() your traversals. This is highlighted in the Getting Started tutorial right at the end of the "The First 5 Minutes" section.

JMeter Script Path missing "\" so not working?

I am trying to use the beanshell script posted here to get the path of the jmx that is being run in my jmeter test - Access to JMeter script path
It is working and if I log the output of the path when set by beanshell or view the variables with the debugger I get the path to the script displayed as I expected -
c:\my\path\to\script
but when I then try to pass that variable into sendKeys, the slashes "\" are being removed so -
c:mypathtoscript
And this doesn't work so I am unable to attach/upload my file..
Sure I am missing something stupid
Thanks
Needed to user vars.put to put the JMeter UDV value into a Javascript variable, then use javascript concatenate to link it all together.
There are at least 2 ways to get this done without using Beanshell:
Call FileServer methods from WebDriver Sampler:
someElement.sendKeys(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir())
Get the value from JMeterVariables
var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
someElement.sendKeys(vars.get('homepath'))
Example full code:
WDS.sampleResult.sampleStart()
WDS.browser.get('http://ya.ru')
var searchInput = WDS.browser.findElement(org.openqa.selenium.By.id('text'))
//directly access function from JavaScript
searchInput.sendKeys(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir())
//alternative way - getting the value from JMeter Variables
var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
searchInput.sendKeys(vars.get('homepath'))
WDS.sampleResult.sampleEnd()
Comprehensive information on accessing JMeter API classes from WebDriver Sampler and few more tips and tricks: The WebDriver Sampler: Your Top 10 Questions Answered

Can you retrieve the Collection Event Script in Deployd as a string for documentation?

I have been using Deployd for a week or so, and was curious if I could expose the contents of the Collections Event Script itself, from the API. (the contents of the /my-project/resources/my-collection/get.js file itself)
This could be useful to automatically produce documentation of the scripts being applied to Get, Post and other requests.
Thanks for the help,
Jacob
This is what I have so far: If I start at localhost:2404/dashboard , I can run the following code in the Chrome Console to retrieve the string content of the GET Event on the collection Tshirts:
dpd('__resources').get(Context.resourceId + '/' + 'get.js', function(res, err)
{
_events['get'] = res && res.value;
console.log(res.value);
});
Context.resourceId simplifies to the collection ID which is just "tshirts".
This successfully outputs the data I am trying to access, but I wonder if it is possible to retrieve from the API. I imagine I need to dig into Node.JS in general to wrap my head around this.
Thanks again,
Jacob

Categories