示例#1
0
    class X(Step):
        a = result('a')
        b = result('b')

        def instructions(self):
            self.a.write_text('')
            self.b.write_text('')
示例#2
0
        class S(Step):
            output = result(file_name)
            trust_cache = expected

            def instructions(self):
                """intentionally non-deterministic"""
                self.output.write_text(uuid4().hex)
示例#3
0
    class PremadeSourceHTTP(Step):
        """Retrieve file from URL via HTTP."""
        output = result(Path(v_url).name)
        keep = v_keep

        _url = v_url
        _other_meta = dict(url=v_url)

        def instructions(self):
            try:
                msg = 'Downloading from URL:\n' + self._url
                logging.info(msg)
                print(msg)
                response = requests.get(self._url, stream=True)
                context = dict(total=int(
                    response.headers.get('content-length', 0)),
                               desc=self.output.name,
                               miniters=1)
                with self.output.open('wb') as f:
                    with tqdm.wrapattr(f, "write", **context) as stream:
                        for chunk in response.iter_content(chunk_size=4096):
                            stream.write(chunk)

            except requests.HTTPError as te:
                logging.error(
                    f'HTTP error while attempting to download: {self._url}')
                raise te
示例#4
0
        class S(Step):
            output = result(sub)

            def instructions(self):
                self.output.touch()
示例#5
0
        class S(Step):
            output = result('file.txt')

            def instructions(self):
                self.output.write_text(uuid4().hex)
示例#6
0
        class S2(Step):
            output = result('file2.txt')

            def instructions(self):
                self.output.touch()
示例#7
0
        class S1(Step):
            output = result(same_file_name)

            def instructions(self):
                self.output.touch()
示例#8
0
        class S1(Step):
            output = result(same_file_name)

            def instructions(self):
                self.output.write_text(uuid4().hex)
示例#9
0
    class X(Step):
        x = result('x')
        y = result('y')

        def instructions(self):
            self.x.write_text('x')
示例#10
0
    class S(Step):
        output = result(file_name)

        def instructions(self):
            self.output.write_text(file_content)