How to Disable celery tasks logs - scrapy

i'm using celery to send task.
i want to see only 'received task ..' and 'Task .. succeeded'
but spider logs on celery server
how to disable task logs?

From your picture i can see that this is debug logs.
So, configure your logger properly or disable DEBUG mode.
Your screenshot doesn't give enough info about the frameworks/libs your are using, so i cannot advice anything else.

You can write a shell script. grep logs you need to annother file per second.
grep -E 'received task|succeeded' celery.log >> task.log

Related

Tomcat disable catalina.out

In our web application deployed on tomcat, catalina.out file keeps growing (it grows in GB's).
So to disable it I found solution where I set CATALINA_OUT=/dev/null.
This worked as expected but we also use kill -3 <PID> command to capture Thread Dump whenever it requires.
This thread dump gets written into catalina.out file but now I have disabled catalina.out so I cannot see thread dump.
How can I get thread dump?
Since it is a production system therefore we are using JRE and not JDK otherwise we would have used jmap/jcmd/jstack commands to capture thread dump.
So, I would like, tomcat should stop creating catalina.out file or do not write log4j statements in it. And if it is disabled then how to get thread dump?
Finally I found the solution which I was looking for. I added below lines of statement in tomcat/bin/startup.sh file
export CATALINA_OUT=/dev/null
export JAVA_OPTS="$JAVA_OPTS -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=thread_dump.log"
CATALINA_OUT set to /dev/null will stop writing log statements in catalina.out log.
JAVA_OPTS -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=thread_dump.log configurations is used to write thread dump statements generated using kill –3 <PID> command. It will also print JVM-related configuration being used.
I hope this will help someone.

How to tell github action that the job had done successfully?

I use github action to deploy my website to my server. The last ssh cmd is npm run start. It will output ready - started server on http://localhost:4000(Since i use Nextjs) finally but it seems that github doesn't know what did it mean and print :
2021/01/09 14:24:14 Error: command timeout
err: Run Command Timeout!
Although the website is successfully deployed, it shows that the Github action failed to execute.
So how to tell github action that the job had done successfully?
You should find a way to start the application in a daemon process of its own, rather than as a process within the SSH session. Perhaps this tool (pm2) might solve your problem? This question and answer is somewhat related.
There are definitely other ways to start your app in a daemon process, or perhaps as a service, but this might be the most straightforward for you since it's a Node tool.

SSH command step not working for one command - in Jmeter

I have a unique problem using jmeter SSH command.
I use this step to run spark jobs.
the problem is that one of the commands not working, to clarify it connects and not get response and just wait and wait for hours, and nothing displayed on screen.
I know how to work with the tool, and this behavior is special for this script alone.
All other script worked, I duplicate one that worked for example
sudo /run_stg.sh this command worked
sudo /run_off2-stg.sh this command not worked
if I run the job manually via jenkins it worked
if I entered to command line and use plik ssh it worked,
the problem is just Jmeter, that is waiting and waiting and I can not understand for what?
the job is about 3 minutes, and I wait for response in Jmeter for 4 hours and nothing Jmeter just waiting.
in the console log I set to trace level and nothing, absolutely no idea how to start handle this issue in Jmeter.
an anyone please assists how to make Jmeter to write what happened?
or just to know if he connect or anything
since this behavior all the test can not be performed
Most probably you are as usual misconfiguring the SSH Command sampler.
The idea is not to run the script per se, you need to delegate the script execution to the Unix Shell, for example Bash this way you will be able to combine several commands together, see the output, amend debugging level, etc.
So I would recommend setting your command to something like /bin/bash -c -x /your/script.sh
Another guess, given you use sudo it might be the case that the sudo command simply waits for the password (which JMeter never provides), if this is the case try amending your script permissions using chmod command and allowing your user its execution without root privileges.
And finally, given you're able to run your command using "plik ssh" (whatever it is) you can run it using OS Process Sampler
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

Celery node fail, on pidbox already using on restart

I have Celery running with RabbitMQ broker.
Today, I have a failure of a Celery node, it doesn't execute tasks and doesn't respond on service celeryd stop command. After few repeats, the node stopped, but on start I get this message:
[WARNING/MainProcess] celery#nodename ready.
[WARNING/MainProcess] /home/ubuntu/virtualenv/project_1/local/lib/python2.7/site-packages/kombu/pidbox.py:73: UserWarning: A node named u'nodename' is already using this process mailbox!
Maybe you forgot to shutdown the other node or did not do so properly?
Or if you meant to start multiple nodes on the same host please make sure
you give each node a unique node name!
warnings.warn(W_PIDBOX_IN_USE % {'hostname': self.hostname})
Can anyone suggest how to unlock process mailbox?
From here http://celery.readthedocs.org/en/latest/userguide/workers.html#starting-the-worker you might need to name each node uniquely. Example:
$ celery -A proj worker --loglevel=INFO --concurrency=10 -n worker1.%h
In supervisor escape by using %%h.
Large log file or not enough free space was a reason, i think.
After deletion all is ok

Monitoring of a Rake Task and Controling it

I would like to get the status of a Rake Task into my backoffice(That means Running or not running).
And I also would like to start the rake task if it is not running. Otherwise I want to quit it.
Any idea?
You can look at this part of a gist: https://gist.github.com/1003601#file_delayed_delta.sh
Basically, I save the PID of the rake task to PIDFILE, then use monit to see if it is running.
https://gist.github.com/1003601#file_monitrc
You could also have a cronjob that runs a system command like ps -ef | grep my_rake_task and see if anything turns up. This may or may not require less effort.