AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Firetask for windows instal free1/17/2024 ![]() ![]() In this case, it’s tarring and gzipping some files according to the parameters the dictionary of itself, and ignoring anything in the fw_spec. It has two sources of information: the keys in fw_spec and a dictionary of self (which includes parameters like base_name used to construct the object). The meat of the Firetask is the run_task(self, fw_spec) method.Because optional_params is also set in this example, the Firetask will perform an additional safety check: it will throw an error if the user attempts to initialize ArchiveTask with any keyword arguments other than those listed in either required_params or optional_params.Īdd your required and optional parameters as desired. Because base_name is in required_params, it must be specified by the user or the FireTask will throw an error. In the example above, an ArchiveTask could be instantiated using something like my_task = ArchiveTask(base_name="my_filename", format="bztar"). As a developer, you can choose whether to add these variables or not - if you do set them, they help with safety and also documentation, thus they are recommended. The required_params and optional_params relate to how the Firetask is constructed.See the Appendix section for working around this and an alternate formulations for identifying the Firetask.Ĭhange the ``fw_name`` value to a desired identifier for your Firetask, e.g. It must be a unique name that is always retained. The _fw_name is how this Firetask is identified.This abstract class does some work under the covers and also requires that you define a run_task(self, fw_spec) method. The class extends the FiretaskBase abstract class.In the first line, the name of the class ( ArchiveDirTask) can be anything - it does not affect the operation of the code if you follow the structure above.Ĭhange the class name to anything you desire. ![]() You can copy this code to a new place and make the following modifications in order to write your Firetask: """ _fw_name = 'ArchiveDirTask' required_params = optional_params = def run_task ( self, fw_spec ): shutil. Args: base_name (str): Name of the file to create. Class ArchiveDirTask ( FiretaskBase ): """ Wrapper around shutil.make_archive to make tar archives.
0 Comments
Read More
Leave a Reply. |