def create(superevent, name, names=None): """ Create a new event record on the git issue tracker from the GraceDB dev server. Parameters ---------- superevent : str The ID of the superevent to be used from GraceDB name : str The name of the event to be recorded in the issue tracker """ data = client.superevent(superevent).json() event_data = client.event(data['preferred_event']).json() if names: with open(names, "r") as datafile: names = json.load(datafile) old_superevent = names['SNAME'][name] else: old_superevent = superevent event_url = f"https://catalog-dev.ligo.org/events/{data['preferred_event']}/view/" event = Event(name=name, repository=f"[email protected]:pe/O3/{old_superevent}", #gid=data['preferred_event'], #gid_url=event_url, calibration = {}, interferometers=event_data['instruments'].split(","), ) event.meta['old superevent'] = old_superevent event.meta['event time'] = event_data['gpstime'] event.meta['working directory'] = f"{config.get('general', 'rundir_default')}/{name}" gitlab.EventIssue.create_issue(repository, event, issue_template="/home/daniel.williams/repositories/asimov/scripts/outline.md")
def get_event(self, event=None): if event: return Event(**self.events[event]) else: return [ Event(**self.events[event]) for event in self.events.keys() ]
def setUp(self): """Create a pipeline.""" self.event = Event.from_yaml(TEST_YAML.format(self.cwd)) self.pipeline = LALInference(self.event.productions[0]) out = self.pipeline.build_dag()
def create(name, oldname=None, gid=None, superevent=None, repo=None): """ Create a new event record in the ledger.. Parameters ---------- superevent : str The ID of the superevent to be used from GraceDB name : str The name of the event to be recorded in the issue tracker names : path, optional The path to the name file which maps between old and new super event IDs oldname: str, optional The old name of the event. """ import pathlib if gid or superevent: from ligo.gracedb.rest import GraceDb, HTTPError client = GraceDb(service_url=config.get("gracedb", "url")) r = client.ping() if superevent: data = client.superevent(superevent).json() event_data = client.event(data['preferred_event']).json() gid = data['preferred_event'] interferometers = event_data['instruments'].split(",") elif gid: event_data = client.event(gid).json() interferometers = event_data['instruments'].split(",") else: event_data = None interferometers = [] if gid or superevent: event_url = f"{config.get('gracedb', 'url')}/events/{gid}/view/" if not repo: repo = None #repo = f"[email protected]:pe/O3/{name}" event = Event( name=name, repository=repo, calibration={}, interferometers=interferometers, ) if oldname: event.meta['old superevent'] = oldname if gid: event.meta['event time'] = event_data['gpstime'] event.meta['gid'] = gid working_dir = os.path.join(config.get('general', 'rundir_default'), name) event.meta['working directory'] = working_dir pathlib.Path(working_dir).mkdir(parents=True, exist_ok=True) if config.get("ledger", "engine") == "gitlab": _, repository = connect_gitlab() from pkg_resources import resource_filename issue_template = resource_filename('asimov', 'gitlabissue.md') gitlab.EventIssue.create_issue(repository, event, issue_template=issue_template) elif config.get("ledger", "engine") == "yamlfile": ledger = Ledger(config.get("ledger", "location")) ledger.add_event(event) ledger.save()
gitlab_events = gitlab.find_events(repository) super_events = set(superevent_ids) - {event.title for event in gitlab_events} # Add the new events for superevent in list(super_events): data = client.superevent(superevent).json() event_data = client.event(data['preferred_event']).json() event_url = f"https://catalog-dev.ligo.org/events/{data['preferred_event']}/view/" event = Event(name=superevent, repository=f"[email protected]:pe/O3/{superevent}", gid=data['preferred_event'], gid_url=event_url, calibration={}, interferometers=event_data['instruments'].split(","), disable_repo=True) gitlab.EventIssue.create_issue(repository, event, issue_template="scripts/outline.md") def find_calibrations(time): with open("../scripts/LLO_calibs.txt") as llo_file: data_llo = llo_file.read().split("\n") data_llo = [ datum for datum in data_llo if datum[-16:] == "FinalResults.txt" ] times_llo = {