Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill VirusTreeSimulator after x number of failures to coalesce #7

Closed
niemasd opened this issue Mar 14, 2018 · 4 comments
Closed

Kill VirusTreeSimulator after x number of failures to coalesce #7

niemasd opened this issue Mar 14, 2018 · 4 comments
Labels

Comments

@niemasd
Copy link
Owner

niemasd commented Mar 14, 2018

VirusTreeSimulator infinite-loops if it keeps failing to coalesce the lineages. Add a way to kill VirusTreeSimulator (and throw an error) if it fails to coalesce after x attempts.

Configuration File

{
    "ContactNetwork":                "NetworkX",

    "ContactNetworkGenerator":       "Complete",
    "num_cn_nodes":                  10,

    "Driver":                        "Default",
    "out_dir":                       "out_NumBranchSample_Fixed",

    "EndCriteria":                   "Transmissions",
    "end_transmissions":             5,

    "Logging":                       "STDOUT",

    "NodeAvailability":              "Perfect",

    "NodeEvolution":                 "VirusTreeSimulator",
    "java_path":                     "java",
    "vts_growthRate":                2.851904,
    "vts_model":                     "constant",
    "vts_n0":                        100000,
    "vts_t50":                       -2,

    "NumBranchSample":               "Fixed",
    "num_viruses_per_cn_sample":     2,

    "NumTimeSample":                 "Once",

    "SeedSelection":                 "Random",
    "num_seeds":                     2,

    "SeedSequence":                  "Random",
    "seed_sequence_length":          10,

    "SequenceEvolution":             "NoMutation",

    "Sequencing":                    "Perfect",

    "SourceSample":                  "Random",

    "TimeSample":                    "End",

    "TransmissionNodeSample":        "RandomSingleInfection",

    "TransmissionTimeSample":        "Fixed",
    "fixed_transmission_time_delta": 1,

    "TreeNode":                      "Simple",

    "TreeUnit":                      "Same",
}
@niemasd
Copy link
Owner Author

niemasd commented Mar 14, 2018

@niemasd
Copy link
Owner Author

niemasd commented Mar 14, 2018

Potential Stack Overflow post to ask if I can't figure it out:

Stack Overflow post

I have a Python 3 script that calls an external tool that repeats itself until it succeeds, and depending on parameter choices to the tool, it may quickly (e.g. instantly) succeed, it may take a few times to succeed, or it may (seemingly) never succeed. When it fails, the tool prints in a manner like this:

Failed to coalesce lineages: 1
Failed to coalesce lineages: 2
Failed to coalesce lineages: 3
...

I am calling the tool like this:

subprocess.call(command, stdout=open("log.txt",'w'))

I want to kill the subprocess call (and throw an error message) after a certain number of failures occur, e.g. when the log file I'm redirecting to has the string Failed to coalesce lineages: 100 in it (meaning the tool failed 100 times). How can I do this cleanly?

@niemasd niemasd added bug and removed enhancement labels Mar 20, 2018
@niemasd
Copy link
Owner Author

niemasd commented Mar 20, 2018

Potentially fixed in 1b4e9df

@niemasd
Copy link
Owner Author

niemasd commented Mar 20, 2018

Fix has been integrated into an official release (1.1.1): https://github.com/niemasd/FAVITES/releases/tag/1.1.1

@niemasd niemasd closed this as completed Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant