class X(Step): a = result('a') b = result('b') def instructions(self): self.a.write_text('') self.b.write_text('')
class S(Step): output = result(file_name) trust_cache = expected def instructions(self): """intentionally non-deterministic""" self.output.write_text(uuid4().hex)
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
class S(Step): output = result(sub) def instructions(self): self.output.touch()
class S(Step): output = result('file.txt') def instructions(self): self.output.write_text(uuid4().hex)
class S2(Step): output = result('file2.txt') def instructions(self): self.output.touch()
class S1(Step): output = result(same_file_name) def instructions(self): self.output.touch()
class S1(Step): output = result(same_file_name) def instructions(self): self.output.write_text(uuid4().hex)
class X(Step): x = result('x') y = result('y') def instructions(self): self.x.write_text('x')
class S(Step): output = result(file_name) def instructions(self): self.output.write_text(file_content)