|
14 | 14 | LOGGER = logging.getLogger(__name__) |
15 | 15 |
|
16 | 16 |
|
| 17 | +def run_cask(arch, args): |
| 18 | + """ |
| 19 | + Run the sample, only creating the cask asset |
| 20 | + """ |
| 21 | + LOGGER.info("Using version %s of rkvst-archivist", about.__version__) |
| 22 | + LOGGER.info("Fetching use case test assets namespace %s", args.namespace) |
| 23 | + |
| 24 | + # Cask Asset |
| 25 | + LOGGER.info("Creating Cask Asset...") |
| 26 | + caskname = "Cask" |
| 27 | + |
| 28 | + cask = Wipp(arch, "TRU RH 72B Cask") |
| 29 | + cask.create( |
| 30 | + caskname, |
| 31 | + "NRC certified type-B road shipping container, capacity 3 x 55-gallon drum", |
| 32 | + args.namespace, |
| 33 | + attachments=[AttachmentDescription("rh72b.png", "arc_primary_image")], |
| 34 | + custom_attrs={"wipp_capacity": "3", "OnboardingSampleID": "TrackAndTrace"}, |
| 35 | + ) |
| 36 | + if cask.existed: |
| 37 | + LOGGER.info("Cask Asset %s already exists", caskname) |
| 38 | + sys_exit(1) |
| 39 | + |
| 40 | + LOGGER.info("Cask Asset Created (Identity=%s)", cask.asset["identity"]) |
| 41 | + |
| 42 | + LOGGER.info("Loading cask...") |
| 43 | + cask.loading( |
| 44 | + { |
| 45 | + "description": "Filled with " + "Drum", |
| 46 | + "container": cask.asset["identity"], |
| 47 | + }, |
| 48 | + custom_asset_attrs={ |
| 49 | + "wipp_inventory": "assets/b7d07310-398a-48d8-990e-49ec94e5de26", |
| 50 | + }, |
| 51 | + attachments=[ |
| 52 | + upload_attachment( |
| 53 | + arch, AttachmentDescription("trupact_loading.jpg", "arc_primary_image") |
| 54 | + ) |
| 55 | + ], |
| 56 | + ) |
| 57 | + LOGGER.info("Loading registered...") |
| 58 | + |
| 59 | + LOGGER.info("Pre-shipping inspection...") |
| 60 | + cask.preshipping( |
| 61 | + { |
| 62 | + "description": "Inspected " + cask.asset["attributes"]["arc_display_name"], |
| 63 | + }, |
| 64 | + attachments=[ |
| 65 | + upload_attachment( |
| 66 | + arch, |
| 67 | + AttachmentDescription( |
| 68 | + "preshipment_inspection.jpg", "arc_primary_image" |
| 69 | + ), |
| 70 | + ) |
| 71 | + ], |
| 72 | + ) |
| 73 | + LOGGER.info("Pre-shipping inspection registered...") |
| 74 | + |
| 75 | + LOGGER.info("Loading departure...") |
| 76 | + cask.departure( |
| 77 | + { |
| 78 | + "description": cask.asset["attributes"]["arc_display_name"] |
| 79 | + + " departing for WIPP." |
| 80 | + }, |
| 81 | + attachments=[ |
| 82 | + upload_attachment( |
| 83 | + arch, AttachmentDescription("truck_departure.jpg", "arc_primary_image") |
| 84 | + ), |
| 85 | + upload_attachment( |
| 86 | + arch, |
| 87 | + AttachmentDescription( |
| 88 | + "SRS_to_WPP_route_instructions.pdf", "approved_route" |
| 89 | + ), |
| 90 | + ), |
| 91 | + ], |
| 92 | + ) |
| 93 | + LOGGER.info("Departure registered...") |
| 94 | + |
| 95 | + # Waypoint |
| 96 | + waypoints = [ |
| 97 | + ["Atlanta", "33.592177", "-84.406064"], |
| 98 | + ["Talladega", "33.592177", "-86.248379"], |
| 99 | + ["Birmingham", "33.494993", "-86.895403"], |
| 100 | + ["Tuscaloosa", "33.184220", "-87.610330"], |
| 101 | + ["Meridian", "32.391672", "-88.532850"], |
| 102 | + ["Jackson", "32.285409", "-90.074633"], |
| 103 | + ["Monroe", "32.463868", "-91.893769"], |
| 104 | + ["Shreveport", "32.537993", "-93.651582"], |
| 105 | + ["Tyler", "32.334001", "-95.321504"], |
| 106 | + ["South Dallas", "32.639816", "-96.826631"], |
| 107 | + ["Gordon", "32.499115", "-98.521317"], |
| 108 | + ["Abilene", "32.457004", "-99.816598"], |
| 109 | + ["Big Spring", "32.244259", "-101.458984"], |
| 110 | + ["Andrews", "32.312469", "-102.548197"], |
| 111 | + ["Seminole", "32.457004", "-99.816598"], |
| 112 | + ["Hobbs", "32.244259", "-101.458984"], |
| 113 | + ] |
| 114 | + for point in waypoints: |
| 115 | + LOGGER.info("Loading waypoints from %s...", point[0]) |
| 116 | + cask.waypoint( |
| 117 | + { |
| 118 | + "description": "TRAGIS smart sensors ping: Checking in near " |
| 119 | + + point[0] |
| 120 | + + " All sensors GREEN", |
| 121 | + "latitude": point[1], |
| 122 | + "longitude": point[2], |
| 123 | + }, |
| 124 | + custom_attrs={ |
| 125 | + "wipp_sensors_shock": "0", |
| 126 | + "wipp_sensors_rad": "45", |
| 127 | + }, |
| 128 | + attachments=[ |
| 129 | + upload_attachment( |
| 130 | + arch, |
| 131 | + AttachmentDescription("truck_departure.jpg", "arc_primary_image"), |
| 132 | + ) |
| 133 | + ], |
| 134 | + ) |
| 135 | + LOGGER.info("Waypoints registered...") |
| 136 | + |
| 137 | + # Arrival |
| 138 | + LOGGER.info("Loading arrival...") |
| 139 | + cask.arrival( |
| 140 | + { |
| 141 | + "description": cask.asset["attributes"]["arc_display_name"] |
| 142 | + + " arriving at WIPP", |
| 143 | + }, |
| 144 | + attachments=[ |
| 145 | + upload_attachment( |
| 146 | + arch, AttachmentDescription("truck_arrival.jpg", "arc_primary_image") |
| 147 | + ) |
| 148 | + ], |
| 149 | + ) |
| 150 | + LOGGER.info("Arrival registered...") |
| 151 | + |
| 152 | + # Unload |
| 153 | + LOGGER.info("Unloading...") |
| 154 | + cask.unloading( |
| 155 | + { |
| 156 | + "description": "Unloaded Drum", |
| 157 | + }, |
| 158 | + custom_asset_attrs={ |
| 159 | + "wipp_inventory": "", |
| 160 | + }, |
| 161 | + attachments=[ |
| 162 | + upload_attachment( |
| 163 | + arch, |
| 164 | + AttachmentDescription("trupact_unloading.jpg", "arc_primary_image"), |
| 165 | + ) |
| 166 | + ], |
| 167 | + custom_attrs={ |
| 168 | + "OnboardingFinalEventMarker": "true", |
| 169 | + }, |
| 170 | + ) |
| 171 | + LOGGER.info("Unloading registered...") |
| 172 | + sys_exit(0) |
| 173 | + |
| 174 | + |
17 | 175 | def run(arch, args): |
18 | 176 | LOGGER.info("Using version %s of rkvst-archivist", about.__version__) |
19 | 177 | LOGGER.info("Fetching use case test assets namespace %s", args.namespace) |
|
0 commit comments