Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23964

Workflow event deferred to cron not rerun when using STATUS_DEFERRED_TO_CRON_REPEAT

    Details

      Description

      1. Create a new custom workflow - called it "mytestworkflow" - that has an event that writes an entry to the error log and uses "STATUS_DEFERRED_TO_CRON_REPEAT":

      eZDebug::writeError("Testing issue #013117: Workflow event deferred to cron");
       
      return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
      

      2. On the admin interface, create a new workflow ("My custom workflow") that uses the custom event created on the previous step;
      3. Assign "My custom workflow" workflow to "content/publish/after" trigger;
      4. Publish a test content;
      5. Table "ezworkflow_process" contains 1 record:

      mysql> SELECT * FROM ezworkflow_process;
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      | activation_date | content_id | content_version | created    | event_id | event_position | event_state | event_status | id | last_event_id | last_event_position | last_event_status | memento_key                      | modified   | node_id | parameters                                                                                                                                                                                                              | process_key                      | session_key | status | user_id | workflow_id |
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      |               0 |          0 |               0 | 1422645977 |       15 |              1 |           0 |            4 | 14 |             0 |                   0 |                 0 | de762a89667cd0bf38f130fb2cb83395 | 1422646021 |       0 | a:7:{s:9:"object_id";s:3:"153";s:7:"version";s:1:"1";s:11:"workflow_id";s:2:"16";s:12:"trigger_name";s:12:"post_publish";s:11:"module_name";s:7:"content";s:15:"module_function";s:7:"publish";s:7:"user_id";s:2:"14";} | 10485af56add69cde53eba64c4e5efdd | 0           |      4 |      14 |          16 |
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      1 row in set (0.00 sec)
      

      6. Notice that the action of "My custom workflow" was performed i.e. a new test entry was created in error.log;
      7. Run "$ php runcronjobs.php workflow". The action of "My custom workflow" was not performed again i.e. no new entry was created in error.log. Output:

      $ php runcronjobs.php workflow
      Using siteaccess  for cronjob
      Running cronjob part 'workflow'
      Running cronjobs/workflow.php at: 30/01/2015 7:32 pm
      Checking for workflow processes
      Status list
      Workflow event deferred to cron job(4): 1
       
      0 out of 1 processes was finished
      Completing cronjobs/workflow.php at: 30/01/2015 7:32 pm
      Elapsed time: 00:00:00
      

      This issue was originally reported in the context of multiplexer event, where there are 2 workflows, in which the first one has a multiplexer event that executes a second custom workflow event. The customer reported that in their tests, the issue only occurs when there is this extra multiplexer event. In my tests, however, the issue happens whether there is a multiplexer event, or not. In any case, here are steps to reproduce for this situation, too:

      1. Create a new custom workflow - called it "mytestworkflow" - that has an event that writes an entry to the error log and uses "STATUS_DEFERRED_TO_CRON_REPEAT":

      eZDebug::writeError("Testing issue #013117: Workflow event deferred to cron");
       
      return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
      

      2. On the admin interface, create a new workflow ("My custom workflow") that uses the custom event created on the previous step;
      3. Create another workflow ("After publishing") with a multiplexer event that in turn executes "My custom workflow";
      4. Assign "After publishing" workflow to "content/publish/after" trigger;
      5. Publish a test content;
      6. Table "ezworkflow_process" contains 2 records:

      mysql> SELECT * FROM ezworkflow_process;
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      | activation_date | content_id | content_version | created    | event_id | event_position | event_state | event_status | id | last_event_id | last_event_position | last_event_status | memento_key                      | modified   | node_id | parameters                                                                                                                                                                                                                                            | process_key                      | session_key | status | user_id | workflow_id |
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      |               0 |          0 |               0 | 1422643706 |       16 |              1 |           0 |            4 |  7 |             0 |                   0 |                 0 | 2eec336291902fb3ff4f2152ac3a6e7e | 1422643706 |       0 | a:7:{s:9:"object_id";s:3:"152";s:7:"version";s:2:"10";s:11:"workflow_id";s:2:"17";s:12:"trigger_name";s:12:"post_publish";s:11:"module_name";s:7:"content";s:15:"module_function";s:7:"publish";s:7:"user_id";s:2:"14";}                              | 1a48d4210e96409f51f8b39d320aefe1 | 0           |      4 |      14 |          17 |
      |               0 |          0 |               0 | 1422643706 |       15 |              1 |           0 |            4 |  8 |             0 |                   0 |                 0 |                                  | 1422643706 |       0 | a:8:{s:9:"object_id";s:3:"152";s:7:"version";s:2:"10";s:11:"workflow_id";s:2:"16";s:12:"trigger_name";s:12:"post_publish";s:11:"module_name";s:7:"content";s:15:"module_function";s:7:"publish";s:7:"user_id";s:2:"14";s:17:"parent_process_id";i:7;} | 238161bd0b2f2cd531a99d4075f5ebe3 | 0           |      9 |      14 |          16 |
      +-----------------+------------+-----------------+------------+----------+----------------+-------------+--------------+----+---------------+---------------------+-------------------+----------------------------------+------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-------------+--------+---------+-------------+
      2 rows in set (0.00 sec)
      

      7. Run "$ php runcronjobs.php workflow". The action of "My custom workflow" is performed i.e. a new entry is created in error.log. Output:

      $ php runcronjobs.php workflow
      Using siteaccess  for cronjob
      Running cronjob part 'workflow'
      Running cronjobs/workflow.php at: 30/01/2015 6:51 pm
      Checking for workflow processes
      Status list
      Workflow event deferred to cron job(4): 1
       
      0 out of 1 processes was finished
      Completing cronjobs/workflow.php at: 30/01/2015 6:51 pm
      Elapsed time: 00:00:00
      

      8. Table "ezworkflow_process" still has the above 2 records, but when I run "$ php runcronjobs.php workflow" again, the action of "My custom workflow" is not re-executed i.e. no new test entry is created in error.log.

        Activity

        Hide
        Gunnstein Lye added a comment - - edited

        In my test I find that the test workflow is run repeatedly as it should, but the error.log entry does not appear. Logging to file is disabled by default when the cronjob runs. You can enable it with --logfiles.

        > php runcronjobs.php --logfiles workflow
        Using siteaccess  for cronjob
        Running cronjob part 'workflow'
        Running cronjobs/workflow.php at: 04/02/2015 4:55 pm
        Checking for workflow processes
        Status list
        Workflow event deferred to cron job(4): 1
         
        0 out of 1 processes was finished
        Completing cronjobs/workflow.php at: 04/02/2015 4:55 pm
        Elapsed time: 00:00:00
        

        With this, the error.log is updated as expected, so I'm closing the issue as invalid.

        Show
        Gunnstein Lye added a comment - - edited In my test I find that the test workflow is run repeatedly as it should, but the error.log entry does not appear. Logging to file is disabled by default when the cronjob runs. You can enable it with --logfiles. > php runcronjobs.php --logfiles workflow Using siteaccess for cronjob Running cronjob part 'workflow' Running cronjobs/workflow.php at: 04/02/2015 4:55 pm Checking for workflow processes Status list Workflow event deferred to cron job(4): 1   0 out of 1 processes was finished Completing cronjobs/workflow.php at: 04/02/2015 4:55 pm Elapsed time: 00:00:00 With this, the error.log is updated as expected, so I'm closing the issue as invalid.

          People

          • Assignee:
            Unassigned
            Reporter:
            Nuno Oliveira (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours
              2h