Skip to content
Snippets Groups Projects

fix/cpy_conf_after_req

Merged Karim Ahmed requested to merge fix/cpy_conf_after_req into master

The copy of the config file is directly written in the local repository after receiving a zmq request(a trigger) and copying all of the generated figures.

Otherwise the config file wont be updated on the remote repository.

Deleting the tmp folder line has been deleted, as I think it is a good idea to have the tmp after a timeout. tmp files might have info over what caused the timeout.

@haufs @karnem

Edited by Karim Ahmed

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 169 169 config['GLOBAL']['report-service']['port']))
    170 170
    171 asyncio.ensure_future(copy_files(conf_file,
    172 config['GLOBAL']['git']['figures-local'],
    173 sem=None))
    174
    175 171 while True:
    176 172 response = await socket.recv_pyobj()
    177 173 await socket.send_pyobj('Build DC reports through -->')
    178 174 logging.info("response: {}".format(response))
    179 175
    176 # Send the conf.yaml file after receiving a zmq-req.
    177 asyncio.ensure_future(copy_files(conf_file,
    178 config['GLOBAL']['git']
    179 ['figures-local'],
    180 sem=None))
  • Only minor comments. LGTM

  • Karim Ahmed changed the description

    changed the description

  • Karim Ahmed added 1 commit

    added 1 commit

    • 09db1cf6 - add a message for temp path

    Compare with previous version

  • 168 168 socket.bind("{}:{}".format(config['GLOBAL']['report-service']['bind-to'],
    169 169 config['GLOBAL']['report-service']['port']))
    170 170
    171 asyncio.ensure_future(copy_files(conf_file,
    172 config['GLOBAL']['git']['figures-local'],
    173 sem=None))
    174
    175 171 while True:
    176 172 response = await socket.recv_pyobj()
    177 173 await socket.send_pyobj('Build DC reports through -->')
    178 174 logging.info("response: {}".format(response))
    179 175
    176 # Send the conf.yaml file after receiving a zmq-req.
    177 asyncio.ensure_future(copy_files(conf_file,
  • Karim Ahmed added 1 commit

    added 1 commit

    Compare with previous version

  • Karim Ahmed added 1 commit

    added 1 commit

    • 4274d1a3 - writing the cfg.yaml after copy.copy

    Compare with previous version

  • Karim Ahmed added 1 commit

    added 1 commit

    • 006ee903 - remove figures-local from conf

    Compare with previous version

  • Karim Ahmed changed the description

    changed the description

  • 204 200 continue
    205 201
    206 202 logging.info('Requested Configuration: {}'.format(req_cfg))
    207
    203
    208 204 async def do_action(cfg):
    205
    209 206 logging.info('Run plot production')
    210 207
    208 fig_local = '{}/figures'.format(cfg['GLOBAL']['git']
    209 ['repo-local'])
  • Karim Ahmed
  • 271 264 out_folder = det_conf['out-folder'].format(
    272 265 instrument=instr_name,
    273 266 detector=det_name)
    274 path = cfg['GLOBAL']['git']['figures-local']
  • Karim Ahmed
  • 295 288 for k, v in det_new_files.items()])
    296 289
    297 290 logging.info('{} figures of {} are copied into {}'.format(
    298 len(figures), det_name, path))
    291 len(figures), det_name, fig_local))
    292
    293 # Write the requested cfg.yaml before pushing all figures.
    294 with open('{}/report_conf.yaml'.format(
    295 fig_local), 'w') as outfile:
    296 yaml.dump(cfg, outfile, default_flow_style=False)
    297
    298 all_new_files.append('{}/report_conf.yaml'.format(fig_local))
    299 299
    • @haufs @karnem please review this.

      Instead of copying the yaml file. The yaml file would be written now directly in the DC-local-repository.

      This makes sure to push the requested config file in cases of:

      • Using the default conf.yaml
      • Choosing some of the instruments (not all) from the default conf.yaml file.
      • Choosing a very different file as the conf.yaml.

      In any case after copying the generated figures and before pushing it to the git, the copied.copied(cfg) file is written into a yaml file in the local repository.

      Edited by Karim Ahmed
    • Please register or sign in to reply
  • Karim Ahmed added 1 commit

    added 1 commit

    • 78c13293 - don't copy sensitive values

    Compare with previous version

  • Karim Ahmed
  • 295 287 for k, v in det_new_files.items()])
    296 288
    297 289 logging.info('{} figures of {} are copied into {}'.format(
    298 len(figures), det_name, path))
    290 len(figures), det_name, fig_local))
    291
    292 # Remove sensitive information from the config file.
    293 del cfg['GLOBAL']
  • Karim Ahmed
  • 204 200 continue
    205 201
    206 202 logging.info('Requested Configuration: {}'.format(req_cfg))
    207
    203
    208 204 async def do_action(cfg):
    209 logging.info('Run plot production')
    210 205
    206 logging.info('Run plot production')
    207 local_repo = cfg['GLOBAL']['git']['repo-local']
    • this parameter is mainly to use it at the end, when pushing to the remote repository.

      It was assigned as a reference as it should always be the same and shouldn't get changed between two concurrent do_actions()

    • Please register or sign in to reply
  • LGTM

  • Thank you for the review!

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading