I have successfully integrated PHP RESQUE in my Ubuntu 14.
How can I get list of failed jobs in PHP to process them? I tried searching on web but could not find specific answer for PHP.
Please help. Thanks in advance.
You have two options: one is using the Resque-web UI: https://github.com/resque/resque-web if you want to install it from scratch or, better yet, there is a Docker container that makes it easy to get it up and running: https://hub.docker.com/r/ennexa/resque-web/~/dockerfile/
Resque-web has a tab to see the failed jobs and the option to reprocess them.
Programmatically, I don't think there is a built-in method that would allow that so I guess you would have to be creative here. For example, from resque-php Github page: You have the ability to retrieve a token identifying a job when you create it:
$token = Resque::enqueue('default', 'My_Job', $args, true);
With that information, you can then retrieve the job status:
$status = new Resque_Job_Status($token);
echo $status->get(); // Outputs the status
You will want to check for this:
Resque_Job_Status::STATUS_FAILED
This also might give you some ideas: https://github.com/chrisboulton/php-resque/issues/324
Related
How to complete a “USER_TASK” in zeebe-client of version 1.1.0 stable?I can’t find a api that could requet the broke to complete a user-task.
Did I ignore something?
I’m a beginner. Please help me.
For example:
What shall I do,if want to complete the user task in client(java)?
enter image description here
User task work similar to normal service tasks, you just need to specify the correct job type. The job type is in that case io.camunda.zeebe:userTask
You can read more about that in the docs https://docs.camunda.io/docs/reference/bpmn-processes/user-tasks/user-tasks/
Is it possible to execute command prompt from Laravel controller? If YES, then how can i execute a command and what is the best way to do this? If NO,is there any other way how i can do this?
I dont Know if I get it.
Cant you use
PHP system()?
If I'm wrong please explain clearly
http://php.net/manual/en/function.system.php
If you only need to run artisan commands (e.g. migrating the database) you can easily do that from your controller:
Route::get('/foo', function () {
$exitCode = Artisan::call('email:send', [
'user' => 1, '--queue' => 'default'
]);
//
});
Source: Laravel Docs
There are some packages available that give you a UI for calling Artisan commands, just search for "laravel artisan web".
If you need to execute other commands you should give us more information about what you're trying to do.
Not 100% sure what you mean with "command prompt" but you can execute commands directly from php with the exec function. This is often not a recommended approach though and I would suspect that it is possible that if you need to run exec there is a design issue in the application.
I would recommend that you consider other approaches to the problem and only use exec in very special conditions.
I'm very new at Gitlab API. I'm using it for my project.
Well, I have one local Gitlab server with many projects (Or maybe it's call "repository") in there.
So, I want to use Laravel to pull some parameter that is list a user's projects by using Gitlab API. Honestly, I have no idea to start this work.
I already read the Gitlab documentation but still can't get it clearly. What I want is the image as below. Could you guys guide me to get this? Thank you very much.
This is what I want.
Here is the GitLab api to read the projects
You can do file-get-contents to read something from api
So, finally as per your gitlab configuration you can do like this to read all the projects
$url = "http://yoururl/api/v4/projects";
$homepage = file_get_contents($url);
echo $homepage;
Hope this helps you.
I need to generate logs in service now whenever the browser is closed or the session is expired. I tried using global business rule but couldnt achieve it. It will be greatfull if i can if i get an idea to achieve this.
Thanks in advance.
I assume you already know how to generate a log and such in ServiceNow, and the problem you're having, is how to run code when the user closed their browser.
The best solution would probably be to create an onload client script which sets onbeforeunload to a function that triggers a log.
More on that here: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
For the second part of your question, user sessions are tracked in a "user sessions" table. If you want to also log when theirs expires, you can do so with a business rule on that table.
You can use
GlideAjax to call from your client script to a server side script include.
Look at GSLog
Try this one
var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");
Short description
I'm getting used to CakePHP right now and am wondering about how to get more debug-information about what is happening inside the framework.
Let me please explain my situation a little more detailed
As you know CakePHP does a lot for you without putting you into the need to write additional code. One example is the handling of models.
I just created a model User and added validation-rules (no other methods). As described in the API methods like save will just work.
After that I created the needed controller and view to add a new user. When I try to add a user from the view I just receive the flash-message The user could not be created. Please, try again. No validation-violations are flashed.
I also did set the debug-level to 2: Configure::write('debug', 2); but do not receive any errors. The error.log inside \tmp\logs is also empty.
I really do want to learn how to solve those issues in the future.
So what else can I do to debug / display inner processes of cake?
Thank you very much for your help!
DebugKit is an official plugin that gives you lots of information on the request, queries and variables produced by Cake:
https://github.com/cakephp/debug_kit
You can also use trace() and other methods in the Debugger to show what is being executed in the background:
http://book.cakephp.org/2.0/en/development/debugging.html
Use a PHP IDE with an integrated debugger. That will allow you to follow execution line by line as it is executed and even inspect variable values as you go. Netbeans is a free one.