def _define_job(self) -> tasks.Job: return tasks.Job(name='test_job', project='test_project', db=self.db, pubsub=self.mock_pubsub, max_parallel_tasks=self.max_parallel_tasks)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Function Flow demo script.""" import base64 import json import logging import time import google.auth from google.cloud import bigquery from google.cloud import pubsub_v1 from gps_building_blocks.cloud.workflows import futures from gps_building_blocks.cloud.workflows import tasks example_job = tasks.Job( name='test_job', schedule_topic='SCHEDULE', max_parallel_tasks=2) @example_job.task(task_id='task_1') def task_1(task: tasks.Task, job: tasks.Job) -> str: """task_1: a simple task that returns a string.""" del task, job logging.info('Running task_1.') return 'result1' @example_job.task(task_id='task_2', deps=['task_1']) def task_2(task: tasks.Task, job: tasks.Job) -> str: """task_3: a simple task that returns a string.""" del task, job logging.info('Running task_2.')