Skip to content

job logging: register partial success for errors happened in writer #430

@anikachurilova

Description

@anikachurilova

For now, there is no easy way to accumulate errors that happened in (async) writer and then mark the job as partial success. As celery registers tasks separately and there is no way to know what each of them returns on the parent.

Some ideas that we had with @kpsherva see in the PR: https://github.com/CERNDocumentServer/cds-rdm/pull/417/files#diff-529cf2439811345762ff015fa8d324431849db041cb062f7f6a774109e33627aR107-R111

https://github.com/CERNDocumentServer/cds-rdm/pull/417/files#diff-6f32013173c802beccb7a15d84f0b83b6f718e07343063c399d1f196a512b9cfR80-R94

write_many method of AsyncWriter:

    def write_many(self, stream_entries, *args, **kwargs):
        """Launches a celery task to write an entry."""

        if "callback" in self._writer:
            write_many_entry.apply_async(
                args=[self._writer, [stream_entry.entry for stream_entry in stream_entries]],
                link=self._writer["callback"].s()
            )
        else:
            write_many_entry.delay(
                self._writer, [stream_entry.entry for stream_entry in stream_entries]
            )

        return stream_entries

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions