-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a sleep so we can delay output purging until command line is templated. If we don't sleep we generate a command line where the output path is just `''`. That needs another fix!
- Loading branch information
Showing
4 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import time | ||
|
||
from galaxy_test.base.populators import DatasetPopulator | ||
|
||
|
||
def purge_while_job_running(dataset_populator: DatasetPopulator, sleep_before_purge=4): | ||
with dataset_populator.test_history() as history_id: | ||
response = dataset_populator.run_tool( | ||
"all_output_types", | ||
inputs={ | ||
"sleep_param": 5, | ||
}, | ||
history_id=history_id, | ||
) | ||
job = dataset_populator.get_job_details(response["jobs"][0]["id"], full=True).json() | ||
# Sleep a second to make sure we template command before purging output | ||
time.sleep(sleep_before_purge) | ||
hda_ids = [] | ||
for output_name, output in job["outputs"].items(): | ||
if output_name == "static_output_2": | ||
# We need to keep one output so the job doesn't get cancelled | ||
continue | ||
dataset_populator.delete_dataset( | ||
history_id=history_id, content_id=output["id"], purge=True, wait_for_purge=True | ||
) | ||
hda_ids.append(output["id"]) | ||
for output_collection in job["output_collections"].values(): | ||
hdca = dataset_populator.get_history_collection_details( | ||
history_id=history_id, content_id=output_collection["id"] | ||
) | ||
for element in hdca["elements"]: | ||
hda_id = element["object"]["id"] | ||
dataset_populator.delete_dataset( | ||
history_id=history_id, content_id=hda_id, purge=True, wait_for_purge=True | ||
) | ||
hda_ids.append(hda_id) | ||
dataset_populator.wait_for_job(job["id"], assert_ok=True) | ||
# Now make sure we can't find the datasets | ||
for hda_id in hda_ids: | ||
exception = None | ||
try: | ||
dataset_populator.get_history_dataset_content(history_id=history_id, dataset_id=hda_id) | ||
except AssertionError as e: | ||
exception = e | ||
assert exception and "The dataset you are attempting to view has been purged" in str(exception) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters