JMeterLibException: 'Value returned by JMeter: 1' - jmeter

when i try to pass current testcase (-Jtestname=${TEST_NAME}
) name along with run jmeter robot keyword getting below error,
JMeterLibException: 'Value returned by JMeter: 1'
Run Jmeter ${jmeter} ${jmxPath} ${logPath} -Jpath=${mdmpath} -Jtestname=${TEST_NAME}
My test case name is "AREA MDM"
As per below log info testcase name is getting assigned against -Jtestname but still getting this exception error,
19:27:46.574 INFO Starting JMeter with following parameters:
- JMeter path: /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh
- Test plan path: /home/sadha/Documents/apache-jmeter-5.4.1/bin/BizomWebMDM.jmx
- Log file path: /home/sadha/Documents/apache-jmeter-5.4.1/Output/log.jtl
- Other parameters: -Jpath=../BizomWeb/venv/resources/Excel/MDM/areas.xls -Jtestname=AREA MDM .
subprocess.call input list: ['/home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh', '-n', '-t', '/home/sadha/Documents/apache-jmeter-5.4.1/bin/BizomWebMDM.jmx', '-l', '/home/sadha/Documents/apache-jmeter-5.4.1/Output/log.jtl', '-Jpath=../BizomWeb/venv/resources/Excel/MDM/areas.xls', '-Jtestname=AREA', 'MDM']
19:27:46.575 FAIL JMeterLibException: 'Value returned by JMeter: 1'
19:27:46.575 DEBUG Traceback (most recent call last):
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 41, in runJmeter
JMeterRunner(jmeterPath, testPlanPath, logFilePath, otherParams)
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 200, in __init__
jmeterOutput = self.runAndPrintResult()
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 234, in runAndPrintResult
raise JMeterLibException("%s %s" % (msg, retValue))
If i pass any dummy string it will work but facing issue ony when i pass current testcase name.

You need to surround your AREA MDM stanza with quotation marks like:
-Jtestname="${TEST_NAME}"
or escape each character which needs to be escaped using backslash like change AREA MDM to AREA\ MDM
More information:
Which characters need to be escaped when using Bash?
How Do I Run JMeter in Non-GUI Mode?

Related

CircleCI Throwing Configuration Error On Variable Expansion With `[\/]` In The Pattern

Description
I'm hitting a validation error in CircleCI
alexlordthorsen#Alexs-MBP ~/git/data/data-platform [255] :( % circleci config validate
Error: Unable to parse YAML
while scanning a double-quoted scalar
in 'string', line 145, column 20:
default: "${CIRCLE_BRANCH//[\/-]/_}"
^
found unknown escape character /(47)
in 'string', line 145, column 40:
... default: "${CIRCLE_BRANCH//[\/-]/_}"
with this command definition
set-build-variables:
parameters:
mwaa_environment:
type: string
description: The MWAA environment that we want to modify with this jobs package build information.
default: "${MWAA_ENVIRONMENT_NAME}"
git_branch:
type: string
# python and s3 both change / and - to _
default: ${CIRCLE_BRANCH//[\/-]/_}
build_number:
type: string
default: "${CIRCLE_BUILD_NUM}"
on a variable expansion that's working in my local shell (both bash and zsh)
alexlordthorsen#Alexs-MBP ~/git/data/data-platform/tests/integration :)% echo "${CIRCLE_BRANCH//[\/-]/_}"
env_dev_qa
Why is circleCI throwing this error?
The issue was solved by dropping the double quotes around the expansion.
default: "${CIRCLE_BRANCH//[\/-]/_}"
to
default: ${CIRCLE_BRANCH//[\/-]/_}

How to call a variable created in the script in Nextflow?

I have a nextflow script that creates a variable from a text file, and I need to pass the value of that variable to a command line order (which is a bioconda package). Those two processes happen inside the "script" part. I have tried to call the variable using the '$' symbol without any results, I think because using that symbol in the script part of a nextflow script is for calling variables defined in the input part.
To make myself clearer, here is a code sample of what I'm trying to achieve:
params.gz_file = '/path/to/file.gz'
params.fa_file = '/path/to/file.fa'
params.output_dir = '/path/to/outdir'
input_file = file(params.gz_file)
fasta_file = file(params.fa_file)
process foo {
//publishDir "${params.output_dir}", mode: 'copy',
input:
path file from input_file
path fasta from fasta_file
output:
file ("*.html")
script:
"""
echo 123 > number.txt
parameter=`cat number.txt`
create_report $file $fasta --flanking $parameter
"""
}
By doig this the error I recieve is:
Error executing process > 'foo'
Caused by:
Unknown variable 'parameter' -- Make sure it is not misspelt and defined somewhere in the script before using it
Is there any way to call the variable parameter inside the script without Nextflow interpreting it as an input file? Thanks in advance!
The documentation re the script block is useful here:
Since Nextflow uses the same Bash syntax for variable substitutions in
strings, you need to manage them carefully depending on if you want to
evaluate a variable in the Nextflow context - or - in the Bash
environment execution.
One solution is to escape your shell (Bash) variables by prefixing them with a back-slash (\) character, like in the following example:
process foo {
script:
"""
echo 123 > number.txt
parameter="\$(cat number.txt)"
echo "\${parameter}"
"""
}
Another solution is to instead use a shell block, where dollar ($) variables are managed by your shell (Bash interpreter), while exclamation mark (!) variables are handled by Nextflow. For example:
process bar {
echo true
input:
val greeting from 'Hello', 'Hola', 'Bonjour'
shell:
'''
echo 123 > number.txt
parameter="$(cat number.txt)"
echo "!{greeting} parameter ${parameter}"
'''
}
declare "parameter" in the top 'params' section.
params.parameter="1234"
(..)
script:
"""
(...)
create_report $file $fasta --flanking ${params.parameter}
(...)
"""
(...)
and call "nextflow run" with "--parameter 87678"

format numbers to 4 digits in Azure Pipline

I try to format 4 digits in Azure pipeline (YAML) but its not working, someone help?
i have this variable >> serialNumber: 2
I used the following yaml syntax:
formatnumber: $[format('{0:D4}', variables.serialNumber)]
formatnumber: $[format('{0:0000}', variables.serialNumber)]
formatnumber: $[format('{0:####}', variables.serialNumber)]
i want to convert the number 2 to 0002 with format but i get the following error:
An error occurred while loading the YAML build pipeline. The format specifiers 'D4' are not valid for objects of type 'String'
The above formater doesnot work is because the type of the value returned by variables.serialNumber is string not int type.
There is a workaround to achieve this. You can add a powershell task to format the number. You can check below example.
trigger:
- master
variables:
number: 2
pool:
vmImage: 'ubuntu-latest'
steps:
- powershell: |
$number = $(number)
$format = "{0:0000}" -f $number
echo "##vso[task.setvariable variable=formatnumber]$format"
- powershell: echo "$(formatnumber)"
Above script in powershell task formats the variable number, and set the formatted number to variable 'formatnumber'. Then the following task can refer to the formatted number by $(formatnumber)

Error defining variable in bash

I am writing simple housekeeping script. this script contains following line of codes.This is a sample code i have extracted from the actual code since it is a big file.
#!/bin/bash
ARCHIVE_PATH=/product/file
FunctionA(){
ARCHIVE_USER=user1 # archive storage user name (default)
ARCHIVE_GROUP=group1 # archive storage user group (default)
functionB
}
functionB() {
_name_Project="PROJECT1"
_path_Componet1=/product/company/Componet1/Logs/
_path_Component2=/product/company/Componet2/Logs/
##Component1##
archive "$(_name_Project)" "$(_path_Componet1)" "filename1" "file.log"
}
archive(){
_name= $1
_path=$2
_filename=$3
_ignore_filename=$4
_today=`date + '%Y-%m-%d'`
_archive=${ARCHIVE_PATH}/${_name}_$(hostname)_$(_today).tar
if [ -d $_path];then
echo "it is a directory"
fi
}
FunctionA
When i run the above script , i get the following error
#localhost.localdomain[] $ sh testScript.sh
testScript.sh: line 69: _name_Component1: command not found
testScript.sh: line 69: _path_Component2: command not found
date: extra operand `%Y-%m-%d'
Try `date --help' for more information.
testScript.sh: line 86: _today: command not found
it is a directory
Could someone explain me what am i doing wrong here.
I see the line: _today=date + '%Y-%m-%d'
One error I spotted was resolved by removing the space between the + and the ' like so:
_today=date +'%Y-%m-%d'
I don't see where the _name_Component1 and _name_Component2 variables are declared so can't help there :)
Your variable expansions are incorrect -- you're using $() which is for executing a subshell substitution. You want ${}, i.e.:
archive "${_name_Project}" "${_path_Componet1}" "filename1" "file.log"
As for the date error, no space after the +.
a few things... you are using $(variable) when it should be ${variable}
on the date command, make sure there is no space between the + and the format
and you have name= $1, you don't want that space there

File filtering_Python 3.2

I'm trying to write a short file filtering code in Python that will find my desired string.
I've got it worked out logically, but my Command Feed is sending me an error message for the print statement. This is how it works as of now:
filename = input('give file name: ')
n = input('give desired string: ')
f = open
line = f.readline()
while line:
if n in line:
print line
line = f.readline()
Error Statement:
Traceback (most recent call last):
File "<string>", line 7, in <fragment>
Syntax Error: print line: <string>, line 718
I know this is a simple problem but the answer is not obvious to me. please help.
print is a function in Python 3. Use print(line) instead.

Resources