Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /cemde_WhatsNext /whatsnext /api /client /task.py
| from typing import Any, Dict, List, Optional | |
| from .utils import random_string | |
| class Task: | |
| """Represents a task template that jobs are based on. | |
| A Task defines the structure for jobs - what command to run and | |
| what resources are needed. | |
| """ | |
| def __init__( | |
| self, | |
| name: str, | |
| command_template: Optional[str] = None, | |
| artifacts: Optional[List[str]] = None, | |
| resource: Optional[List[str]] = None, | |
| ) -> None: | |
| self.id = random_string() | |
| self.name = name | |
| self.artifacts = artifacts or [] | |
| self.resource = resource or [] | |
| self._command_template = command_template | |
| def format_command(self, parameters: Dict[str, Any]) -> str: | |
| """Format the command template with the given parameters.""" | |
| if self._command_template is None: | |
| raise ValueError("No command template defined for this task") | |
| return self._command_template.format(**parameters) | |
Xet Storage Details
- Size:
- 967 Bytes
- Xet hash:
- e8ce33cd479c0e6aca9921e649005d2d895a43047a12246ea088bef3d61c8dc0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.