def main():
    """Main Function"""
    num_blocks = int(sys.argv[1]) if len(sys.argv) == 2 else 3
    clear_db()
    for block_id in generate_scheduling_block_id(num_blocks=num_blocks,
                                                 project='sip'):
        config = {
            "id": block_id,
            "sub_array_id": str(random.choice(range(3))),
            "processing_blocks": []
        }
        for i in range(random.randint(1, 3)):
            config['processing_blocks'].append({
                "id": "{}:pb{:03d}".format(block_id, i),
                "workflow": {
                    "name": "{}".format(random.choice(['vis_ingest_01',
                                                       'dask_ical_01',
                                                       'dask_maps_01'])),
                    "template": {},
                    "stages": []
                }
            })
        print('-' * 40)
        print(json.dumps(config, indent=2))
        add_scheduling_block(config)
def main ( ) : num_blocks = int ( sys . argv [ 1 ] ) if len ( sys . argv ) == 2 else 3 clear_db ( ) for block_id in generate_scheduling_block_id ( num_blocks = num_blocks , project = 'sip' ) : config = { "id" : block_id , "sub_array_id" : str ( random . choice ( range ( 3 ) ) ) , "processing_blocks" : [ ] } for i in range ( random . randint ( 1 , 3 ) ) : config [ 'processing_blocks' ] . append ( { "id" : "{}:pb{:03d}" . format ( block_id , i ) , "workflow" : { "name" : "{}" . format ( random . choice ( [ 'vis_ingest_01' , 'dask_ical_01' , 'dask_maps_01' ] ) ) , "template" : { } , "stages" : [ ] } } ) print ( '-' * 40 ) print ( json . dumps ( config , indent = 2 ) ) add_scheduling_block ( config )
Main Function