<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Advanced
Step1:  As always, let's do imports and initialize a logger and a new Bundle.  See Building a System for more details.
Step2:  Now we'll add datasets
Step3:  Run Compute
Here we just pass detach=True to any run_compute call.  We'll immediately be returned to the prompt instead of waiting for the results to complete.
Step4:  If we then try to access the model, we see that there is instead a single parameter that is a placeholder - this parameter stores information on how to check the progress of the run_compute job and how to load the resulting model once it's complete
Step5:  Re-attaching to a Job
We can check on the job's status
Step6:  If we want, we can even save the Bundle and load it later to retrieve the results.  In this case where the job is being run in a different Python thread but on the same machine, you cannot, however, exit Python or restart your machine.  
When detaching and running on a server (coming soon), you will then be able to exit your Python session or even open the Bundle on a different machine.
Step7:  And at any point we can choose to "re-attach".  If the job isn't yet complete, we'll be in a wait loop until it is.  Once the job is complete, the new model will be loaded and accessible.
<ASSISTANT_TASK:>
Python Code:
!pip install -I "phoebe>=2.1,<2.2"
Explanation: Advanced: Detaching from Run Compute
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
%matplotlib inline
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
Explanation: As always, let's do imports and initialize a logger and a new Bundle.  See Building a System for more details.
End of explanation
b.add_dataset('lc', times=np.linspace(0,20,501))
Explanation: Now we'll add datasets
End of explanation
b.run_compute(detach=True, model='mymodel')
Explanation: Run Compute
Here we just pass detach=True to any run_compute call.  We'll immediately be returned to the prompt instead of waiting for the results to complete.
End of explanation
b['mymodel']
Explanation: If we then try to access the model, we see that there is instead a single parameter that is a placeholder - this parameter stores information on how to check the progress of the run_compute job and how to load the resulting model once it's complete
End of explanation
b['mymodel'].status
Explanation: Re-attaching to a Job
We can check on the job's status
End of explanation
b.save('test_detach.bundle')
b = phoebe.Bundle.open('test_detach.bundle')
b['mymodel'].status
Explanation: If we want, we can even save the Bundle and load it later to retrieve the results.  In this case where the job is being run in a different Python thread but on the same machine, you cannot, however, exit Python or restart your machine.  
When detaching and running on a server (coming soon), you will then be able to exit your Python session or even open the Bundle on a different machine.
End of explanation
b['mymodel'].attach()
b['mymodel']
axs, artists = b['mymodel'].plot()
Explanation: And at any point we can choose to "re-attach".  If the job isn't yet complete, we'll be in a wait loop until it is.  Once the job is complete, the new model will be loaded and accessible.
End of explanation
<END_TASK>