Skip to content

File Uploader Result

Bases: FileResult

Representation of file upload result.

Container for file paths, divided into certain categories:

  • :obj:~successful
  • :obj:~failed
  • :obj:~skipped
  • :obj:~missing

.. versionadded:: 0.3.0

Examples

from onetl.file import FileUploader uploader = FileUploader(target_path="/remote", ...) upload_result = uploader.run( ... [ ... "/local/file1", ... "/local/file2", ... "/failed/file", ... "/existing/file", ... "/missing/file", ... ] ... ) upload_result UploadResult( successful=FileSet([ RemoteFile("/remote/file1"), RemoteFile("/remote/file2"), ]), failed=FileSet([ FailedLocalFile("/failed/file") ]), skipped=FileSet([ LocalPath("/existing/file") ]), missing=FileSet([ LocalPath("/missing/file") ]), )

Source code in onetl/file/file_uploader/result.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
class UploadResult(FileResult):
    """
    Representation of file upload result.

    Container for file paths, divided into certain categories:

    * :obj:`~successful`
    * :obj:`~failed`
    * :obj:`~skipped`
    * :obj:`~missing`

    .. versionadded:: 0.3.0

    Examples
    --------

    >>> from onetl.file import FileUploader
    >>> uploader = FileUploader(target_path="/remote", ...)
    >>> upload_result = uploader.run(
    ...     [
    ...         "/local/file1",
    ...         "/local/file2",
    ...         "/failed/file",
    ...         "/existing/file",
    ...         "/missing/file",
    ...     ]
    ... )
    >>> upload_result
    UploadResult(
        successful=FileSet([
            RemoteFile("/remote/file1"),
            RemoteFile("/remote/file2"),
        ]),
        failed=FileSet([
            FailedLocalFile("/failed/file")
        ]),
        skipped=FileSet([
            LocalPath("/existing/file")
        ]),
        missing=FileSet([
            LocalPath("/missing/file")
        ]),
    )
    """

    successful: FileSet[RemoteFile] = Field(default_factory=FileSet)
    "File paths (remote) which were uploaded successfully"

    failed: FileSet[FailedLocalFile] = Field(default_factory=FileSet)
    "File paths (local) which were not uploaded because of some failure"

    skipped: FileSet[LocalPath] = Field(default_factory=FileSet)
    "File paths (local) which were skipped because of some reason"

    missing: FileSet[LocalPath] = Field(default_factory=FileSet)
    "File paths (local) which are not present in the local file system"

successful = Field(default_factory=FileSet) class-attribute instance-attribute

File paths (remote) which were uploaded successfully

failed = Field(default_factory=FileSet) class-attribute instance-attribute

File paths (local) which were not uploaded because of some failure

skipped = Field(default_factory=FileSet) class-attribute instance-attribute

File paths (local) which were skipped because of some reason

missing = Field(default_factory=FileSet) class-attribute instance-attribute

File paths (local) which are not present in the local file system