def register_function(self, container_type='docker', location=None, ep_id=None, group=None): from funcx import FuncXClient assert self.extr_func is not None, "Extractor function must first be registered!" if location is None: location = self.store_url fxc = FuncXClient() container_id = fxc.register_container( location=location, container_type=container_type, name='kube-tabular', description='I don\'t think so!', ) self.func_id = fxc.register_function(self.extr_func, ep_id, group=group, container_uuid=container_id, description="A sum function") print(f"The function has been updated! " f"Please copy/paste the following code into {self.func_id} function class:\n") print(self.func_id) return self.func_id
# xpcs_x = XPCSExtractor() # xpcs_x = NetCDFExtractor() # xpcs_x = JsonXMLExtractor() # xpcs_x = HDFExtractor() # xpcs_x = ImagesExtractor() # xpcs_x = KeywordExtractor() # xpcs_x = PythonExtractor() # xpcs_x = TabularExtractor() xpcs_x = CCodeExtractor() # xpcs_x = TikaExtractor() ep_id = "2293034e-4c9f-459c-a6f0-0ed310a8e618" extractor_name = "matio" repo_name = "mdf" container_uuid = fxc.register_container(f'/home/tskluzac/.xtract/.containers/xtract-{extractor_name}.img', 'singularity') print("Container UUID: {}".format(container_uuid)) fn_uuid = fxc.register_function(base_extractor, container_uuid=container_uuid, description="Tabular test function.") print("FN_UUID : ", fn_uuid) task_batch_size = 1 # 128 fx_batch_size = 64 # 32 hdf_count = 0 task_batches = Queue() missing_file = "/Users/tylerskluzacek/missing_files.json" missing_file_0 = "/Users/tylerskluzacek/missing_mdf2.json" # missing_file = None # missing_file = None
""" This script will run the Gladier team's XPCS script on each file from the 2021-1 file set on Petrel. It will do so on Theta. """ # TODO: # 1. Point to the right xpcs_data file. # 2. Point to the right bunch of metadata files. fxc = FuncXClient() xpcs_x = XPCSExtractor() trimester = "2019-3" ep_id = "12ff7fa9-a76b-4188-82ea-1c0081c3c73a" container_uuid = fxc.register_container('/home/tskluzac/.xtract/.containers/xtract-xpcs.img', 'singularity') print("Container UUID: {}".format(container_uuid)) fn_uuid = fxc.register_function(base_extractor, container_uuid=container_uuid, description="Tabular test function.") print("FN_UUID : ", fn_uuid) task_batch_size = 128 fx_batch_size = 32 max_tasks_at_ep = 5000 hdf_count = 0 task_batches = Queue() max_count = 500000
# 'xtract-netcdf/xtract-netcdf.img' ] def hello_container(event): import os return f"Container version: {os.environ['container_version']}" for container in all_containers: print(f"Using funcX version: {funcx.__version__}") fxc = FuncXClient() base_path = '/home/tskluzac/ext_repos/' container_path = os.path.join(base_path, container) print(f"Container path: {container_path}") container_uuid = fxc.register_container(container_path, 'singularity') fn_uuid = fxc.register_function( hdf_extract, container_uuid=container_uuid, description="New sum function defined without string spec") print(f"FN UUID: {fn_uuid}") res = fxc.run(sample_hdf_1, endpoint_id=js_ep_id, function_id=fn_uuid) print(res) for i in range(100): # TODO: break when successful try: x = fxc.get_result(res) print(x) break
# * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from funcx import FuncXClient from sx_multi import run_coffea_processor fxc = FuncXClient() container_id = fxc.register_container( "bengal1/funcx_coffea:add_schema_to_notebooks", "docker", "Coffea Processor") function_id = fxc.register_function( run_coffea_processor, "Run your coffea process code in a setup environment", container_uuid=container_id) print("Function_ID is ", function_id)
# id_list = ['dbc7a749-f689-419c-b114-2f9eb8146496'] id_list = ['c8f24648-6b96-4d58-ac14-93ccf81da12c'] def sleep_func(file_ls): import time # # # for item in file_ls: # # with open(item, 'r') as f: # # f.close() # # time.sleep(sleep_s) return "hello, world!" # func_id = fxc.register_function(function=sleep_func, function_name='hpdc_sleep_extractor') container_uuid = fxc.register_container('/home/tskluzac/xtract-matio.img', 'singularity') print("Container UUID: {}".format(container_uuid)) func_id = fxc.register_function(matio_extract, #ep_id, # TODO: We do not need ep id here container_uuid=container_uuid, description="New sum function defined without") for fx_id in id_list: for i in range(1,10): task_id = fxc.run({'event'}, endpoint_id=fx_id, function_id=func_id) while True: result = fxc.get_batch_result([task_id]) print(result)