Git Product home page Git Product logo

Comments (25)

rmcdaniel avatar rmcdaniel commented on May 20, 2024 2

As far as coding standards I have plans to add:

        "phpstan/phpstan": "^1.9",
        "rector/rector": "^0.14.7",
        "symplify/easy-coding-standard": "^11.1"

And then we can have:

https://gist.github.com/rmcdaniel/310d9b0ccb52ca399da80d1650538077

and

https://gist.github.com/rmcdaniel/05627aa809f31edb9abca6b5d52d4a3a

and

    - name: Check coding style via ECS
      run: vendor/bin/ecs check
    - name: Run static analysis via PHPStan
      run: vendor/bin/phpstan --xdebug analyse app tests

to our GitHub actions.

Also we can use rector to auto-refactor before committing.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 2

Closing this for now. Feel free to re-open or create a new issue if something else persists! Thanks everyone!

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1

Regarding the PostgreSQL issue, can you change the migration that the package publishes with a different type of column that would work? That article mentions using bytea columns.

from laravel-workflow.

michael-rubel avatar michael-rubel commented on May 20, 2024 1

Consider the usage of BC Check and Infection. These are very powerful tools to ensure quality.

Also, take a look at Laravel Pint instead of easy-coding-standard for styling. 🤙

from laravel-workflow.

michael-rubel avatar michael-rubel commented on May 20, 2024 1

@rmcdaniel tried bytea column type, doesn't help.
Found an issue someone's got with another package, and they came up with encoding the content with base64.
Changing that will be a breaking change for those who already use the package, though.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1

#31

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1
encoding  size   increase
none      2058   +0.00%
yenc      2068   +0.49%
base64    2744   +33.33%

Based on some experiments so far, base64 is always 33% overhead but yenc is way better since the version I made only encodes nulls and nothing else.

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024 1

In that case, I won’t track the issue down. Seems to me like it has to do with the stack trace, which is always unpredictable. There is also the possibility of using Laravel’s baked-in serializable-closure package — not sure if that's a viable option…

Just want to say this package is really neat – it’s going to solve quite a few headaches on my end. 😅

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024 1

@michael-rubel @mikerockett I have released version 0.0.20. It now uses https://github.com/opis/closure which is a very widely used package by Google, PHP League, Yii, etc. This also kills two birds because it supports signatures which was on the TODO as well.

The library's key features:

Serialize any closure
Serialize arbitrary objects
Doesn't use eval for closure serialization or unserialization
...
Supports cryptographically signed closures

As far as the issue with serializing models goes. I see why it's not working like you would expect. I think I can make it support it. For now I would just recommend calling ->toArray() on the model before passing it in or just pass the $id only but just make sure you don't do any database calls in a workflow, only an activity.

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024 1

0.0.20 works well with exceptions. Also happy with manually fetching – the workflows I've created so far will be running 100s of times each day, so storing only an ID, as opposed to a serialized model class and ID, works better imo.

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024 1

Thanks Richard, that sounds good to me. I have a few chained operations that I'm starting to move over, and am also building out a custom frontend that integrates with a custom Horizon frontend that runs in our SPA.

Might have some suggestions in the near future, but holding off for the moment due to your current focus, and perhaps that they might make things deviate from Temporal – from a syntax perspective – a little too much. 😉

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

@michael-rubel Yes! I would love to have you as a contributor! 😃

Take a look at https://temporal.io/ and https://github.com/temporalio/sdk-php to see what direction this project is headed. Laravel Workflow is essentially a mostly compatible version of their PHP SDK but using Laravel queues instead of their service. There is also https://github.com/laravel-workflow/flowmeter which is a benchmarking framework that is helpful for development.

That being said, if you do want something that's ready for production right now, Temporal is highly recommended. They have a free self-host version and a paid cloud service.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

I'm not too worried about breaking changes until we get to version 1.0. My main concern is adding overhead with base64. There is also something like https://en.wikipedia.org/wiki/YEnc which was used many years ago to avoid nulls and other special characters. However it's not as widespread and standardized as base64 so that's a tradeoff.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

I'm going to figure this out Friday since I have some time off. I'm going to first try to just get things working with BLOB or some kind of binary field and get it working across MySQL/PostgreSQL uniformly. If that doesn't work for some reason (I think it should) then I'll fall back to some sort of encoding/decoding scheme. Either way it'll get sorted and released this weekend!

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

Digging more looks like you're right and I walked into a hornets nest. 😂

I'm working on a simple yenc encoder now.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

Added minimal yenc, tests for pqsql, rector, ecs, phpstan and added to the github actions. There was a similar bug for mysql so this should actually be backwards compatible. Will work on unit tests soon rather than just feature/integration tests.

@michael-rubel Let me know if this update works for you. Thanks!

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024

When passing a model to a workflow (on instantiation), it’s serializing the entire thing. I’d expect it to honour the SerializesModels trait. Is this behaviour intentional?

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024

I’m also getting errors about being unable to serialize closures – this happens when an Activity attempts to log an exception. Not sure which closure it is yet, but will check.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

@mikerockett Are you using MySQL or PostgreSQL?

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024

Postgres. Needed to update to .19 to solve the previous serialization issue. Anyway, I had a look, and it seems to fall over with any exception, such as a class not found exception. On the off chance that this is related to my specific project (it's quite large and does an immense amount of custom stuff), I'm going to try and trace this and see what happens in a fresh project.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

Okay I am starting to think just serializing the exceptions is kind of brittle. I'm going to look at transforming them to JSON which is a little more effort but will probably be more stable. Thanks for trying this out!

I will also look at the model serialization as well.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

Added unit tests, code coverage and https://scrutinizer-ci.com/g/laravel-workflow/laravel-workflow/

I will work on getting the coverage up!

Part of the problem with the coverage being so low is because much of the code is actually running inside another process (the queue worker) during the tests.

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024

Thanks – will give it a spin.

I see that laravel/serializable-closure was created as a fork due to opis/closure switching to FFI (which is not enabled by default) in 4.x, but it looks like that hasn’t happened yet. That being said, I don’t see the harm in having FFI as a requirement, once 4.x is finally released.

On serialization, I’ll pass the ID in for now. No harm in a little manual find. 😉

from laravel-workflow.

mikerockett avatar mikerockett commented on May 20, 2024

Do you have a roadmap on the cards? I know, pre-alpha, maybe too early. Just curious as to a 'more-or-less' on plans, as I'd really like to use this in a project I run, already in production. I could well use Temporal, but would rather stick to one background system, like Horizon.

from laravel-workflow.

rmcdaniel avatar rmcdaniel commented on May 20, 2024

@mikerockett The only features left that I can think of are nested workflows and continueAsNew. Right now, the main focus is on stability and performance. I think this project is in a pretty good position to start experimenting with it in production. If you hit any blocking issues, you can easily migrate to Temporal. Also, if need any help setting up or debugging I will work pro bono.

from laravel-workflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.