Robotframework + Process + Log timestamp - robotframework

I would understand how to properly display logs of a Python process executed in Roboframework.
Let's suppose that ${result1.stdout} is this one:
*INFO:1536834347873* ciao ciao
*INFO:1536834347883* ciao ciao2
Is it possibile to transform them in two robotframework logs with the right date? If I use the "Log keyword" they will have the keywork execution timestamp...
Rr
Note: I'm executing the python script with "start process". I need this because I need to run in parallel multiple scripts
| | Start Process | python .${/}files${/}testPython.py | alias=First | shell=yes | stderr=/tmp/provaerr1.log | stdout=/tmp/prova1.log |
| | ${result1}= | Wait For Process | First |
| | Log | ${result1.stdout}
|

Related

Why am I getting a "Variable not found" error in this Robot Framework code using DataDriver?

I am attempting to use the DataDriver package https://pypi.org/project/robotframework-datadriver/ with Robot Framework to generate a test report from a csv file generated in a test run. Here's the contents of the file:
${testid},${crc},${rrc}
100,1,0
101,1,1
102,0,1
The robot file is:
| *** Settings *** |
| Library | DataDriver | file=cr-run.csv | encoding=utf-8
| Test Template | Check Capture Replay Record
| *** Test Case ***
| Check Capture Replay Record ${testid}
| *** Keywords ***
| Check Capture Replay Record
| | [Arguments] | ${testid}
| | ... | ${crc}
| | ... | ${rrc}
| | Should Be Equal As Integers | ${crc} | ${rrc}
The error is Variable '${testid}' not found.
Datadriver works fine for other examples. I have tried many variations and read available docs, but I am stumped. Any suggestions would be appreciated.

Will Erlang Scheduler make process causing re-queue problem?

Background: I'm confuse with Erlang's scheduler for a long time until have a look at The Beam Book. I had do some research on async/non-blocking programming in some language(Elixir/Erlang, Scala/Java, Golang) which include Actor pattern, Future/Promise, coroutine mainly. Coroutine and Actor pattern is similarly in term of they can both think as lightweight process.
The Problem
I'm find a weakness of the async programming: It will cause a lightweight-process(or a task) re-queue to the end of the scheduler Ready Queue if it invoke any of the block operation. The block operation will not block OS-Thread but it occurred mainly because of invoke a async action such as 'aio_read'.
re-queue means the process will be put at the end of Scheduler even if the process is just scheduled.In server-side programming, it will make a client request delay with a relatively long time compare with it should process time.The Beam Book give a detail description:
A processs trying to do a receive on an empty mailbox or on a mailbox with no matching messages will yield and go into the waiting state.
When a message is delivered to an inbox the sending process will check whether the receiver is sleeping in the waiting state, and in that case it will wake the process, change its state to runable, and put it at the end of the appropriate ready queue.
The affect could be see in many benchmark test: More request, more response time for every request.
A good scheduler should make the response time nearly the real process time of the request if ignore OS-Thread Context Switch.
I haven't seem others discuss the aspect yet.
As a conclusion, there are two question:
1. I want make a confirm whether re-queue problem really exist in async-programming world.
2. Besides, Is Erlang really has the problem if it handle tens of thousands of the process, especially use many GenServer.call in a request-response-chain?
Your answers are here: https://hamidreza-s.github.io/erlang/scheduling/real-time/preemptive/migration/2016/02/09/erlang-scheduler-details.html
Reposting it here, allowing edits.
Erlang Scheduling
Erlang as a real-time platform for multitasking uses Preemptive Scheduling. The responsibility of an Erlang scheduler is selecting a Process and executing their code. It also does Garbage Collection and Memory Management. The factor of selecting a process for execution is based on their priority level which is configurable per process and in each priority level processes are scheduled in a round robin fashion. On the other hand the factor of preempting a process from execution is based on a certain number of Reductions since the last time it was selected for execution, regardless of its priority level. The reduction is a counter per process that is normally incremented by one for each function call. It is used for preempting processes and context switching them when the counter of a process reaches the maximum number of reductions. For example in Erlang/OTP R12B this maximum number was 2000 reductions.
The scheduling of tasks in Erlang has a long history. It has been changing over the time. These changes were affected by the changes in SMP (Symmetric Multi-Processing) feature of Erlang.
Scheduling Before R11B
Before R11B Erlang did not have SMP support, so just one scheduler was run in the main OS process’s thread and accordingly just one Run Queue existed. The scheduler picked runnable Erlang processes and IO tasks from the run queue and executed them.
Erlang VM
+--------------------------------------------------------+
| |
| +-----------------+ +-----------------+ |
| | | | | |
| | Scheduler +--------------> Task # 1 | |
| | | | | |
| +-----------------+ | Task # 2 | |
| | | |
| | Task # 3 | |
| | | |
| | Task # 4 | |
| | | |
| | Task # N | |
| | | |
| +-----------------+ |
| | | |
| | Run Queue | |
| | | |
| +-----------------+ |
| |
+--------------------------------------------------------+
This way there was no need to lock data structures but the written application couldn’t take advantage of parallelism.
Scheduling In R11B and R12B
SMP support was added to Erlang VM so it could have 1 to 1024 schedulers each was run in one OS process’s thread. However, in this version schedulers could pick runnable tasks from just one common run queue.
Erlang VM
+--------------------------------------------------------+
| |
| +-----------------+ +-----------------+ |
| | | | | |
| | Scheduler # 1 +--------------> Task # 1 | |
| | | +---------> | |
| +-----------------+ | +----> Task # 2 | |
| | | | | |
| +-----------------+ | | | Task # 3 | |
| | | | | | | |
| | Scheduler # 2 +----+ | | Task # 4 | |
| | | | | | |
| +-----------------+ | | Task # N | |
| | | | |
| +-----------------+ | +-----------------+ |
| | | | | | |
| | Scheduler # N +---------+ | Run Queue | |
| | | | | |
| +-----------------+ +-----------------+ |
| |
+--------------------------------------------------------+
Because of the resulting parallelism of this method, all shared data structures are protected with locks. For example the run queue itself is a shared data structure which must be protected. Although the lock can provide performance penalty, the performance improvements which was achieved in multi-core processors systems was interesting.
Some known bottlenecks in this version was as follows:
The common run queue becomes a bottleneck when the number of schedulers increases.
Increasing the involved lock of ETS tables which also affects Mnesia.
Increasing the lock conflicts when many processes are sending messages to the same process.
A process waiting to get a lock can block its scheduler.
However, separating run queues per scheduler was picked to solve these bottleneck issues in next versions.
Scheduling After R13B
In this version each scheduler has its own run queue. It decreases the number of lock conflicts in systems with many schedulers on many cores and also improves the overall performance.
Erlang VM
+--------------------------------------------------------+
| |
| +-----------------+-----------------+ |
| | | | |
| | Scheduler # 1 | Run Queue # 1 <--+ |
| | | | | |
| +-----------------+-----------------+ | |
| | |
| +-----------------+-----------------+ | |
| | | | | |
| | Scheduler # 2 | Run Queue # 2 <----> Migration |
| | | | | Logic |
| +-----------------+-----------------+ | |
| | |
| +-----------------+-----------------+ | |
| | | | | |
| | Scheduler # N | Run Queue # N <--+ |
| | | | |
| +-----------------+-----------------+ |
| |
+--------------------------------------------------------+
This way the locking conflicts when accessing the run queue is solved but introduces some new concerns:
How fair is the process of dividing tasks among run queues?
What if one scheduler gets overloaded with tasks while others are idle?
Based on what order a scheduler can steal tasks from an overloaded scheduler?
What if we started many schedulers but there all so few tasks to do?
These concerns lead the Erlang team to introduce a concept for making scheduling fair and efficient, the Migration Logic. It tries to control and balance run queues based on the statistics that collects from the system.
However we should not depend on the scheduling to remain exactly as it is today, because it is likely to be changed in future releases in order to get better.
As a conclusion, there are two question:
1. I want make a confirm whether re-queue problem really exist in async-programming world.
2. Besides, Is Erlang really has the problem if it handle tens of thousands of the process, especially use many GenServer.call in a
request-response-chain?
Depending which Erlang version are you talking about there are different tradeoffs. Since there are multiple queues in newer Erlang versions your problem does not exist in the form you are specifying it.
I have seen Erlang (and its VM) handle millions of Erlang processes just fine, also used an Erlang based system to handle 100.000+ clients with really tight SLA on the latency. Not sure about the details of your problem, but a reasonably written Erlang/Elixir service can handle the workload you specified unless there is something you left out.

What's the official workflow/lifecycle diagram for the command events triggering in symfony?

Question
Just the same way that there are nice "official" infographics for the "Http Kernel" events workflow/lifecycle of the in Symfony, is there any diagram for the console events?
Context
For example: you can see a chart of when the http kernel events are triggered here:
https://symfony.com/doc/current/components/http_kernel.html
where you can see there "painted" in blue-colored boxes events like
kernel.request
kernel.controller
kernel.exception
kernel.view
kernel.terminate
[among others]
and in the middle, in purple-colored boxes the executions that the kernel does.
For the command
I guess that, according to this https://symfony.com/doc/current/components/console/events.html the workflow must be something like this:
...
|
V
+--------------------+
| dispatch the |
| console.exception |
| console.error (3.3)|
+--------------------+
|
|
V
/------------------\ +--------------------+ +--------------------+ +--------------------+ +--------------------+ /------------------\
/ command line \ | Call the | | dispatch the | | Call the | | dispatch the | / flush output \
| invocation |---->| Command::configure |---->| console.command |---->| Command::execute |---->| console.terminate |---->| buffer and return |
\ from the bash / | of all commands | | | | on selectd command | | | \ to the bash /
\------------------/ +--------------------+ +--------------------+ +--------------------+ +--------------------+ \------------------/
So the question is if there is any "official" graphic for this from the symfony guys.
Thnx.

Large image upload from Horizon will be saving state forever

I am running openstack icehouse and trying to upload a 16 GB image from horizon.
Horizon and Glance are running on seperate machines.
The image is fully copied to Glance Node(checked by verifying image file size under /var/lib/glance/images/). But the image status continues to be in saving state forever, The status does not become active.
The output of nova image-show displays.
+----------------------+--------------------------------------+
| Property | Value |
+----------------------+--------------------------------------+
| OS-EXT-IMG-SIZE:size | 16947544064 |
| created | 2014-11-06T13:26:25Z |
| id | 46f6218d-2f17-493a-8bc9-a46562cbefff |
| minDisk | 0 |
| minRam | 0 |
| name | very_huge_image |
| progress | 50 |
| status | SAVING |
| updated | 2014-11-06T13:26:25Z |
+----------------------+--------------------------------------+
But when I try to upload same image with Glance CLI from horizon machine then in some time image status becomes active and ready to use.
Any help/suggestion would be greatly appreciated.
Thanks in advance.

Arguments gone missing for robot-framework

The below is rewarded with a complaint that Remove Directory requires 1 or 2 arguments and I gave it none. I'm using 2.6.3, and dcsLshLocation is a variable (and adding an x in front doesn't change the error). I'm using the Java version of all this.
*** Settings ***
| Documentation | http://jira.basistech.net:8080/browse/JEST-226
| Resource | src/main/resources/jug-shared-keywords.txt
| Force Tags | integration |
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory | ${dcsLshLocation} |
| Suite Teardown | Run Keywords | Shutdown Derby
| Test Timeout | 20 minutes
When this question was originally written, Run Keywords could only run keywords that do not take arguments. That is no longer true. From the documentation:
Starting from Robot Framework 2.7.6, keywords can also be run with arguments using upper case AND as a separator between keywords. The keywords are executed so that the first argument is the first keyword and proceeding arguments until the first AND are arguments to it. First argument after the first AND is the second keyword and proceeding arguments until the next AND are its arguments. And so on.
The code in the question can thus be expressed like this:
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations
| | ... | AND | Launch Derby Server
| | ... | AND | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | AND | Remove Directory | ${dcsLshLocation}
The following is the original answer to the question, which others may still find useful. It is still relevant for versions of robot framework prior to 2.7.6.
When you use Run Keywords, you cannot run keywords that take arguments. Admittedly the documentation is a bit unclear, but this is what it says:
User keywords must nevertheless be used if the executed keywords need
to take arguments.
What it should say is that, when you use Run Keywords, each argument is the name of a keyword to run. This keyword cannot take any arguments itself because robot can't know where the arguments for one keyword ends and the next keyword begins.
Remember that ... simply means that the previous row is continued on the next, so while it looks like each row is a separate keyword with arguments, it's not. You example is the same as:
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory |
| | ... | ${dcsLshLocation} |

Resources